| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "zc/zc_sys.h" | ||
| 2 | |||
| 3 | #include "allegro/gfx.h" | ||
| 4 | #include "allegro5/joystick.h" | ||
| 5 | #include "base/files.h" | ||
| 6 | #include "base/render.h" | ||
| 7 | #include "zalleg/zalleg.h" | ||
| 8 | #include "base/qrs.h" | ||
| 9 | #include "base/dmap.h" | ||
| 10 | #include <functional> | ||
| 11 | #include <stdio.h> | ||
| 12 | #include <stdlib.h> | ||
| 13 | #include <cstring> | ||
| 14 | #include <math.h> | ||
| 15 | #include <map> | ||
| 16 | #include <filesystem> | ||
| 17 | #include <ctype.h> | ||
| 18 | #include <sstream> | ||
| 19 | #include "base/version.h" | ||
| 20 | #include "base/zc_alleg.h" | ||
| 21 | #include "gamedata.h" | ||
| 22 | #include "zc/replay_upload.h" | ||
| 23 | #include "zc/zc_init.h" | ||
| 24 | #include "init.h" | ||
| 25 | #include "zc/replay.h" | ||
| 26 | #include "zc/cheats.h" | ||
| 27 | #include "zc/render.h" | ||
| 28 | #include "base/zc_math.h" | ||
| 29 | #include "base/zapp.h" | ||
| 30 | #include "dialog/cheatkeys.h" | ||
| 31 | #include "metadata/metadata.h" | ||
| 32 | #include "zc/zelda.h" | ||
| 33 | #include "zc/saves.h" | ||
| 34 | #include "tiles.h" | ||
| 35 | #include "base/colors.h" | ||
| 36 | #include "pal.h" | ||
| 37 | #include "base/zsys.h" | ||
| 38 | #include "qst.h" | ||
| 39 | #include "zc/zc_sys.h" | ||
| 40 | #include "play_midi.h" | ||
| 41 | #include "gui/jwin_a5.h" | ||
| 42 | #include "base/jwinfsel.h" | ||
| 43 | #include "base/gui.h" | ||
| 44 | #include "midi.h" | ||
| 45 | #include "subscr.h" | ||
| 46 | #include "zc/maps.h" | ||
| 47 | #include "sprite.h" | ||
| 48 | #include "zc/guys.h" | ||
| 49 | #include "zc/hero.h" | ||
| 50 | #include "zc/title.h" | ||
| 51 | #include "particles.h" | ||
| 52 | #include "sound/zcmusic.h" | ||
| 53 | #include "zconsole.h" | ||
| 54 | #include "zc/ffscript.h" | ||
| 55 | #include "dialog/info.h" | ||
| 56 | #include "dialog/alert.h" | ||
| 57 | #include "zc/combos.h" | ||
| 58 | #include "zc/jit.h" | ||
| 59 | #include "zc/zc_subscr.h" | ||
| 60 | #include <fmt/format.h> | ||
| 61 | #include "zconsole/ConsoleLogger.h" | ||
| 62 | #include "zinfo.h" | ||
| 63 | #include "base/misctypes.h" | ||
| 64 | #include "music_playback.h" | ||
| 65 | #include <base/new_menu.h> | ||
| 66 | #include <base/files.h> | ||
| 67 | |||
| 68 | #ifdef __EMSCRIPTEN__ | ||
| 69 | #include "base/emscripten_utils.h" | ||
| 70 | #endif | ||
| 71 | |||
| 72 | using namespace std::chrono_literals; | ||
| 73 | |||
| 74 | extern bool Playing; | ||
| 75 | int32_t sfx_voice[WAV_COUNT]; | ||
| 76 | int32_t d_stringloader(int32_t msg,DIALOG *d,int32_t c); | ||
| 77 | int32_t d_midilist_proc(int32_t msg,DIALOG *d,int32_t c); | ||
| 78 | |||
| 79 | static ALLEGRO_JOYSTICK* gamepad_dlg_cur_joystick; | ||
| 80 | static int32_t d_joylist_proc(int32_t msg,DIALOG *d,int32_t c); | ||
| 81 | |||
| 82 | extern byte monochrome_console; | ||
| 83 | |||
| 84 | extern HeroClass Hero; | ||
| 85 | extern zcmodule moduledata; | ||
| 86 | extern sprite_list guys, items, Ewpns, Lwpns, chainlinks, decorations; | ||
| 87 | extern particle_list particles; | ||
| 88 | extern int32_t loadlast; | ||
| 89 | extern char *sfx_string[WAV_COUNT]; | ||
| 90 | byte use_dwm_flush; | ||
| 91 | byte use_save_indicator; | ||
| 92 | int32_t paused_midi_pos = 0; | ||
| 93 | byte midi_suspended = 0; | ||
| 94 | byte zc_192b163_warp_compatibility; | ||
| 95 | char modulepath[2048]; | ||
| 96 | bool epilepsyFlashReduction; | ||
| 97 | signed char pause_in_background_menu_init = 0; | ||
| 98 | byte pause_in_background = 0; | ||
| 99 | bool is_sys_pal = false; | ||
| 100 | static bool load_control_called_this_frame; | ||
| 101 | extern PALETTE* hw_palette; | ||
| 102 | extern bool update_hw_pal; | ||
| 103 | extern const char* dmaplist(int32_t index, int32_t* list_size); | ||
| 104 | int32_t getnumber(const char *prompt,int32_t initialval); | ||
| 105 | |||
| 106 | extern bool kb_typing_mode; //script only, for disbaling key presses affecting Hero, etc. | ||
| 107 | extern int32_t cheat_modifier_keys[4]; //two options each, default either control and either shift | ||
| 108 | |||
| 109 | static const char *qst_module_name = "current_module"; | ||
| 110 | #ifdef ALLEGRO_LINUX | ||
| 111 | static const char *samplepath = "samplesoundset/patches.dat"; | ||
| 112 | #endif | ||
| 113 | char qst_files_path[2048]; | ||
| 114 | |||
| 115 | extern TopMenu the_player_menu; | ||
| 116 | #ifdef _MSC_VER | ||
| 117 | #define getcwd _getcwd | ||
| 118 | #endif | ||
| 119 | |||
| 120 | bool rF11(); | ||
| 121 | bool rI(); | ||
| 122 | bool rQ(); | ||
| 123 | bool zc_key_pressed(); | ||
| 124 | |||
| 125 | #ifdef _WIN32 | ||
| 126 | |||
| 127 | // This should only be necessary for MinGW, since it doesn't have a dwmapi.h. Add another #ifdef if you like. | ||
| 128 | extern "C" | ||
| 129 | { | ||
| 130 | typedef HRESULT(WINAPI *t_DwmFlush)(); | ||
| 131 | typedef HRESULT(WINAPI *t_DwmIsCompositionEnabled)(BOOL *pfEnabled); | ||
| 132 | } | ||
| 133 | |||
| 134 | void do_DwmFlush() | ||
| 135 | { | ||
| 136 | static HMODULE shell = LoadLibrary("dwmapi.dll"); | ||
| 137 | |||
| 138 | if(!shell) | ||
| 139 | return; | ||
| 140 | |||
| 141 | static t_DwmFlush flush=reinterpret_cast<t_DwmFlush>(GetProcAddress(shell, "DwmFlush")); | ||
| 142 | static t_DwmIsCompositionEnabled isEnabled=reinterpret_cast<t_DwmIsCompositionEnabled>(GetProcAddress(shell, "DwmIsCompositionEnabled")); | ||
| 143 | |||
| 144 | BOOL enabled; | ||
| 145 | isEnabled(&enabled); | ||
| 146 | |||
| 147 | if(isEnabled) | ||
| 148 | flush(); | ||
| 149 | } | ||
| 150 | |||
| 151 | #endif // _WIN32 | ||
| 152 | |||
| 153 | 266 | void zc_exit(int code) | |
| 154 | { | ||
| 155 | extern CConsoleLoggerEx zscript_coloured_console; | ||
| 156 | |||
| 157 |
1/2✓ Branch 0 taken 266 times.
✗ Branch 1 not taken.
|
266 | if (replay_get_mode() == ReplayMode::Record) replay_save(); |
| 158 | 266 | replay_stop(); | |
| 159 | 266 | music_stop(); | |
| 160 | 266 | kill_sfx(); | |
| 161 | |||
| 162 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 250 times.
|
266 | if (get_qr(qr_OLD_SCRIPT_VOLUME)) |
| 163 | { | ||
| 164 | //restore user volume settings | ||
| 165 |
2/2✓ Branch 0 taken 249 times.
✓ Branch 1 taken 1 times.
|
250 | if (FFCore.coreflags & FFCORE_SCRIPTED_MIDI_VOLUME) |
| 166 | { | ||
| 167 | 1 | master_volume(-1, ((int32_t)FFCore.usr_midi_volume)); | |
| 168 | 1 | } | |
| 169 |
2/2✓ Branch 0 taken 249 times.
✓ Branch 1 taken 1 times.
|
250 | if (FFCore.coreflags & FFCORE_SCRIPTED_DIGI_VOLUME) |
| 170 | { | ||
| 171 | 1 | master_volume((int32_t)(FFCore.usr_digi_volume), 1); | |
| 172 | 1 | } | |
| 173 |
2/2✓ Branch 0 taken 249 times.
✓ Branch 1 taken 1 times.
|
250 | if (FFCore.coreflags & FFCORE_SCRIPTED_MUSIC_VOLUME) |
| 174 | { | ||
| 175 | 1 | emusic_volume = (int32_t)FFCore.usr_music_volume; | |
| 176 | 1 | } | |
| 177 |
1/2✓ Branch 0 taken 250 times.
✗ Branch 1 not taken.
|
250 | if (FFCore.coreflags & FFCORE_SCRIPTED_SFX_VOLUME) |
| 178 | { | ||
| 179 | ✗ | sfx_volume = (int32_t)FFCore.usr_sfx_volume; | |
| 180 | ✗ | } | |
| 181 | 250 | } | |
| 182 |
1/2✓ Branch 0 taken 266 times.
✗ Branch 1 not taken.
|
266 | if ( FFCore.coreflags&FFCORE_SCRIPTED_PANSTYLE ) |
| 183 | { | ||
| 184 | ✗ | pan_style = (int32_t)FFCore.usr_panstyle; | |
| 185 | ✗ | } | |
| 186 | 266 | save_game_configs(); | |
| 187 | |||
| 188 | 266 | zscript_coloured_console.kill(); | |
| 189 | 266 | jit_shutdown(); | |
| 190 | 266 | quit_game(); | |
| 191 | |||
| 192 | 266 | Z_message("ZQuest Classic web site: https://zquestclassic.com\n"); | |
| 193 | 266 | Z_message("ZQuest Classic old wiki: https://web.archive.org/web/20210910193102/https://zeldaclassic.com/wiki\n"); | |
| 194 | 266 | Z_message("ZQuest Classic new wiki: https://github.com/ZQuestClassic/ZQuestClassic/wiki\n"); | |
| 195 | |||
| 196 | 266 | allegro_exit(); | |
| 197 | 266 | exit(code); | |
| 198 | } | ||
| 199 | |||
| 200 | 92829 | bool flash_reduction_enabled(bool check_qr) | |
| 201 | { | ||
| 202 |
4/4✓ Branch 0 taken 88404 times.
✓ Branch 1 taken 4425 times.
✓ Branch 2 taken 87576 times.
✓ Branch 3 taken 92001 times.
|
92829 | return (check_qr && get_qr(qr_EPILEPSY)) || epilepsyFlashReduction || replay_is_debug(); |
| 203 | } | ||
| 204 | |||
| 205 | // Dialogue largening | ||
| 206 | ✗ | void large_dialog(DIALOG *d) | |
| 207 | { | ||
| 208 | ✗ | large_dialog(d, 1.5); | |
| 209 | ✗ | } | |
| 210 | |||
| 211 | ✗ | void large_dialog(DIALOG *d, float RESIZE_AMT) | |
| 212 | { | ||
| 213 | ✗ | if(!d[0].d1) | |
| 214 | { | ||
| 215 | ✗ | d[0].d1 = 1; | |
| 216 | ✗ | int32_t oldwidth = d[0].w; | |
| 217 | ✗ | int32_t oldheight = d[0].h; | |
| 218 | ✗ | int32_t oldx = d[0].x; | |
| 219 | ✗ | int32_t oldy = d[0].y; | |
| 220 | ✗ | d[0].x -= int32_t(d[0].w/RESIZE_AMT); | |
| 221 | ✗ | d[0].y -= int32_t(d[0].h/RESIZE_AMT); | |
| 222 | ✗ | d[0].w = int32_t(d[0].w*RESIZE_AMT); | |
| 223 | ✗ | d[0].h = int32_t(d[0].h*RESIZE_AMT); | |
| 224 | |||
| 225 | ✗ | for(int32_t i=1; d[i].proc !=NULL; i++) | |
| 226 | { | ||
| 227 | // Place elements horizontally | ||
| 228 | ✗ | double xpc = ((double)(d[i].x - oldx) / (double)oldwidth); | |
| 229 | ✗ | d[i].x = int32_t(d[0].x + (xpc*d[0].w)); | |
| 230 | |||
| 231 | ✗ | if(d[i].proc != d_stringloader) | |
| 232 | { | ||
| 233 | ✗ | if(d[i].proc==d_bitmap_proc) | |
| 234 | { | ||
| 235 | ✗ | d[i].w *= 2; | |
| 236 | ✗ | } | |
| 237 | ✗ | else d[i].w = int32_t(d[i].w*RESIZE_AMT); | |
| 238 | ✗ | } | |
| 239 | |||
| 240 | // Place elements vertically | ||
| 241 | ✗ | double ypc = ((double)(d[i].y - oldy) / (double)oldheight); | |
| 242 | ✗ | d[i].y = int32_t(d[0].y + (ypc*d[0].h)); | |
| 243 | |||
| 244 | // Vertically resize elements | ||
| 245 | ✗ | if(d[i].proc == jwin_edit_proc || d[i].proc == jwin_check_proc || d[i].proc == jwin_checkfont_proc) | |
| 246 | { | ||
| 247 | ✗ | d[i].h = int32_t((double)d[i].h*1.5); | |
| 248 | ✗ | } | |
| 249 | ✗ | else if(d[i].proc == jwin_droplist_proc || d[i].proc == d_joylist_proc) | |
| 250 | { | ||
| 251 | ✗ | d[i].y += int32_t((double)d[i].h*0.25); | |
| 252 | ✗ | d[i].h = int32_t((double)d[i].h*1.25); | |
| 253 | ✗ | } | |
| 254 | ✗ | else if(d[i].proc==d_bitmap_proc) | |
| 255 | { | ||
| 256 | ✗ | d[i].h *= 2; | |
| 257 | ✗ | } | |
| 258 | ✗ | else d[i].h = int32_t(d[i].h*RESIZE_AMT); | |
| 259 | |||
| 260 | // Fix frames | ||
| 261 | ✗ | if(d[i].proc == jwin_frame_proc) | |
| 262 | { | ||
| 263 | ✗ | d[i].x++; | |
| 264 | ✗ | d[i].y++; | |
| 265 | ✗ | d[i].w-=4; | |
| 266 | ✗ | d[i].h-=4; | |
| 267 | ✗ | } | |
| 268 | ✗ | } | |
| 269 | ✗ | } | |
| 270 | |||
| 271 | ✗ | for(int32_t i=1; d[i].proc!=NULL; i++) | |
| 272 | { | ||
| 273 | ✗ | if(d[i].proc==jwin_slider_proc) | |
| 274 | ✗ | continue; | |
| 275 | |||
| 276 | // Bigger font | ||
| 277 | ✗ | bool bigfontproc = (d[i].proc != d_midilist_proc && d[i].proc != jwin_droplist_proc && d[i].proc != jwin_abclist_proc && d[i].proc != jwin_list_proc && d[i].proc != d_joylist_proc); | |
| 278 | |||
| 279 | ✗ | if(!d[i].dp2 && bigfontproc) | |
| 280 | { | ||
| 281 | ✗ | d[i].dp2 = get_zc_font(font_lfont_l); | |
| 282 | ✗ | } | |
| 283 | ✗ | else if(!bigfontproc) | |
| 284 | { | ||
| 285 | ✗ | ((ListData *)d[i].dp)->font = &a4fonts[font_lfont_l]; | |
| 286 | ✗ | } | |
| 287 | |||
| 288 | // Make checkboxes work | ||
| 289 | ✗ | if(d[i].proc == jwin_check_proc) | |
| 290 | ✗ | d[i].proc = jwin_checkfont_proc; | |
| 291 | ✗ | else if(d[i].proc == jwin_radio_proc) | |
| 292 | ✗ | d[i].proc = jwin_radiofont_proc; | |
| 293 | ✗ | } | |
| 294 | |||
| 295 | ✗ | jwin_center_dialog(d); | |
| 296 | ✗ | } | |
| 297 | |||
| 298 | static char cfg_sect[] = "zeldadx"; //We need to rename this. | ||
| 299 | static char ctrl_sect[] = "Controls"; | ||
| 300 | static char sfx_sect[] = "Volume"; | ||
| 301 | |||
| 302 | ✗ | int32_t d_dummy_proc(int32_t,DIALOG *,int32_t) | |
| 303 | { | ||
| 304 | ✗ | return D_O_K; | |
| 305 | } | ||
| 306 | |||
| 307 | ✗ | bool is_reserved_key(int c) | |
| 308 | { | ||
| 309 | ✗ | switch(c) | |
| 310 | { | ||
| 311 | case KEY_ESC: | ||
| 312 | ✗ | return true; | |
| 313 | } | ||
| 314 | ✗ | return false; | |
| 315 | ✗ | } | |
| 316 | ✗ | bool is_reserved_keycombo(int c, int modflag) | |
| 317 | { | ||
| 318 | ✗ | if(c==KEY_F4 && (modflag&KB_ALT_FLAG)) | |
| 319 | ✗ | return true; | |
| 320 | ✗ | return false; | |
| 321 | ✗ | } | |
| 322 | ✗ | bool checkcheat(Cheat cheat) | |
| 323 | { | ||
| 324 | ✗ | if(cheatkeys[cheat][0] && zc_readkey(cheatkeys[cheat][0])) | |
| 325 | ✗ | return true; //Main key pressed | |
| 326 | ✗ | if(cheatkeys[cheat][1] && zc_readkey(cheatkeys[cheat][1])) | |
| 327 | ✗ | return true; //Alt key pressed | |
| 328 | ✗ | return false; | |
| 329 | ✗ | } | |
| 330 | 266 | void load_default_cheatkeys() | |
| 331 | { | ||
| 332 | 266 | memset(cheatkeys, 0, sizeof(cheatkeys)); | |
| 333 | 266 | cheatkeys[Cheat::Life][0] = KEY_H; | |
| 334 | 266 | cheatkeys[Cheat::Life][1] = KEY_ASTERISK; | |
| 335 | 266 | cheatkeys[Cheat::Magic][0] = KEY_M; | |
| 336 | 266 | cheatkeys[Cheat::Magic][1] = KEY_SLASH_PAD; | |
| 337 | 266 | cheatkeys[Cheat::Rupies][0] = KEY_R; | |
| 338 | 266 | cheatkeys[Cheat::Bombs][0] = KEY_B; | |
| 339 | 266 | cheatkeys[Cheat::Arrows][0] = KEY_A; | |
| 340 | 266 | cheatkeys[Cheat::Clock][0] = KEY_I; | |
| 341 | 266 | cheatkeys[Cheat::Walls][0] = KEY_F11; | |
| 342 | 266 | cheatkeys[Cheat::Fast][0] = KEY_Q; | |
| 343 | 266 | cheatkeys[Cheat::Light][0] = KEY_L; | |
| 344 | 266 | cheatkeys[Cheat::IgnoreSideView][0] = KEY_V; | |
| 345 | 266 | cheatkeys[Cheat::Kill][0] = KEY_K; | |
| 346 | 266 | cheatkeys[Cheat::GoTo][0] = KEY_G; | |
| 347 | 266 | cheatkeys[Cheat::TrigSecrets][0] = KEY_S; | |
| 348 | 266 | cheatkeys[Cheat::ShowL0][0] = KEY_0; | |
| 349 | 266 | cheatkeys[Cheat::ShowL1][0] = KEY_1; | |
| 350 | 266 | cheatkeys[Cheat::ShowL2][0] = KEY_2; | |
| 351 | 266 | cheatkeys[Cheat::ShowL3][0] = KEY_3; | |
| 352 | 266 | cheatkeys[Cheat::ShowL4][0] = KEY_4; | |
| 353 | 266 | cheatkeys[Cheat::ShowL5][0] = KEY_5; | |
| 354 | 266 | cheatkeys[Cheat::ShowL6][0] = KEY_6; | |
| 355 | 266 | cheatkeys[Cheat::ShowFFC][0] = KEY_7; | |
| 356 | 266 | cheatkeys[Cheat::ShowSprites][0] = KEY_8; | |
| 357 | 266 | cheatkeys[Cheat::ShowWalkability][0] = KEY_W; | |
| 358 | 266 | cheatkeys[Cheat::ShowEffects][0] = KEY_E; | |
| 359 | 266 | cheatkeys[Cheat::ShowOverhead][0] = KEY_O; | |
| 360 | 266 | cheatkeys[Cheat::ShowPushblock][0] = KEY_P; | |
| 361 | 266 | cheatkeys[Cheat::ShowHitbox][0] = KEY_C; | |
| 362 | 266 | cheatkeys[Cheat::ShowFFCScripts][0] = KEY_F; | |
| 363 | 266 | } | |
| 364 | |||
| 365 | static bool loaded_game_configs; | ||
| 366 | |||
| 367 | 266 | void load_game_configs() | |
| 368 | { | ||
| 369 | 266 | loaded_game_configs = true; | |
| 370 | 266 | strcpy(moduledata.module_name,zc_get_config("ZCMODULE",qst_module_name,"modules/classic.zmod")); | |
| 371 | 266 | joystick_index = zc_get_config(ctrl_sect,"joystick_index",0); | |
| 372 | 266 | js_stick_1_x_stick = zc_get_config(ctrl_sect,"js_stick_1_x_stick",0); | |
| 373 | 266 | js_stick_1_x_axis = zc_get_config(ctrl_sect,"js_stick_1_x_axis",0); | |
| 374 | 266 | js_stick_1_x_offset = zc_get_config(ctrl_sect,"js_stick_1_x_offset",0) ? 128 : 0; | |
| 375 | 266 | js_stick_1_y_stick = zc_get_config(ctrl_sect,"js_stick_1_y_stick",0); | |
| 376 | 266 | js_stick_1_y_axis = zc_get_config(ctrl_sect,"js_stick_1_y_axis",1); | |
| 377 | 266 | js_stick_1_y_offset = zc_get_config(ctrl_sect,"js_stick_1_y_offset",0) ? 128 : 0; | |
| 378 | 266 | js_stick_2_x_stick = zc_get_config(ctrl_sect,"js_stick_2_x_stick",1); | |
| 379 | 266 | js_stick_2_x_axis = zc_get_config(ctrl_sect,"js_stick_2_x_axis",0); | |
| 380 | 266 | js_stick_2_x_offset = zc_get_config(ctrl_sect,"js_stick_2_x_offset",0) ? 128 : 0; | |
| 381 | 266 | js_stick_2_y_stick = zc_get_config(ctrl_sect,"js_stick_2_y_stick",1); | |
| 382 | 266 | js_stick_2_y_axis = zc_get_config(ctrl_sect,"js_stick_2_y_axis",1); | |
| 383 | 266 | js_stick_2_y_offset = zc_get_config(ctrl_sect,"js_stick_2_y_offset",0) ? 128 : 0; | |
| 384 | 266 | analog_movement = (zc_get_config(ctrl_sect,"analog_movement",1)); | |
| 385 | |||
| 386 | //cheat modifier keya | ||
| 387 | 266 | cheat_modifier_keys[0] = zc_get_config(ctrl_sect,"key_cheatmod_a1",KEY_ZC_LCONTROL); | |
| 388 | 266 | cheat_modifier_keys[1] = zc_get_config(ctrl_sect,"key_cheatmod_a2",0); | |
| 389 | 266 | cheat_modifier_keys[2] = zc_get_config(ctrl_sect,"key_cheatmod_b1",KEY_ZC_RCONTROL); | |
| 390 | 266 | cheat_modifier_keys[3] = zc_get_config(ctrl_sect,"key_cheatmod_b2",0); | |
| 391 | |||
| 392 | //cheat keys | ||
| 393 | 266 | load_default_cheatkeys(); | |
| 394 | char buf[256]; | ||
| 395 |
2/2✓ Branch 0 taken 266 times.
✓ Branch 1 taken 9576 times.
|
9842 | for(size_t q = 1; q < Cheat::Last; ++q) |
| 396 | { | ||
| 397 |
1/2✓ Branch 0 taken 9576 times.
✗ Branch 1 not taken.
|
9576 | if(!bindable_cheat((Cheat)q)) continue; |
| 398 | 9576 | std::string cheatname = cheat_to_string((Cheat)q); | |
| 399 |
1/2✓ Branch 0 taken 9576 times.
✗ Branch 1 not taken.
|
9576 | util::lowerstr(cheatname); |
| 400 | 9576 | sprintf(buf, "key_cheat_%s_main", cheatname.c_str()); | |
| 401 |
1/2✓ Branch 0 taken 9576 times.
✗ Branch 1 not taken.
|
9576 | cheatkeys[q][0] = zc_get_config(ctrl_sect,buf,cheatkeys[q][0]); |
| 402 | 9576 | sprintf(buf, "key_cheat_%s_alt", cheatname.c_str()); | |
| 403 |
1/2✓ Branch 0 taken 9576 times.
✗ Branch 1 not taken.
|
9576 | cheatkeys[q][1] = zc_get_config(ctrl_sect,buf,cheatkeys[q][1]); |
| 404 | 9576 | } | |
| 405 | |||
| 406 |
1/2✓ Branch 0 taken 266 times.
✗ Branch 1 not taken.
|
266 | if((uint32_t)joystick_index >= MAX_JOYSTICKS) |
| 407 | ✗ | joystick_index = 0; | |
| 408 | |||
| 409 | 266 | Akey = zc_get_config(ctrl_sect,"key_a",KEY_Z); | |
| 410 | 266 | Bkey = zc_get_config(ctrl_sect,"key_b",KEY_X); | |
| 411 | 266 | Skey = zc_get_config(ctrl_sect,"key_s",KEY_ENTER); | |
| 412 | 266 | Lkey = zc_get_config(ctrl_sect,"key_l",KEY_Q); | |
| 413 | 266 | Rkey = zc_get_config(ctrl_sect,"key_r",KEY_W); | |
| 414 | 266 | Pkey = zc_get_config(ctrl_sect,"key_p",KEY_SPACE); | |
| 415 | 266 | Exkey1 = zc_get_config(ctrl_sect,"key_ex1",KEY_A); | |
| 416 | 266 | Exkey2 = zc_get_config(ctrl_sect,"key_ex2",KEY_S); | |
| 417 | 266 | Exkey3 = zc_get_config(ctrl_sect,"key_ex3",KEY_D); | |
| 418 | 266 | Exkey4 = zc_get_config(ctrl_sect,"key_ex4",KEY_C); | |
| 419 | |||
| 420 | 266 | DUkey = zc_get_config(ctrl_sect,"key_up", KEY_UP); | |
| 421 | 266 | DDkey = zc_get_config(ctrl_sect,"key_down", KEY_DOWN); | |
| 422 | 266 | DLkey = zc_get_config(ctrl_sect,"key_left", KEY_LEFT); | |
| 423 | 266 | DRkey = zc_get_config(ctrl_sect,"key_right",KEY_RIGHT); | |
| 424 | |||
| 425 | 266 | Abtn = zc_get_config(ctrl_sect,"btn_a",2); | |
| 426 | 266 | Bbtn = zc_get_config(ctrl_sect,"btn_b",1); | |
| 427 | 266 | Sbtn = zc_get_config(ctrl_sect,"btn_s",10); | |
| 428 | 266 | Mbtn = zc_get_config(ctrl_sect,"btn_m",9); | |
| 429 | 266 | Lbtn = zc_get_config(ctrl_sect,"btn_l",5); | |
| 430 | 266 | Rbtn = zc_get_config(ctrl_sect,"btn_r",6); | |
| 431 | 266 | Pbtn = zc_get_config(ctrl_sect,"btn_p",12); | |
| 432 | 266 | Exbtn1 = zc_get_config(ctrl_sect,"btn_ex1",7); | |
| 433 | 266 | Exbtn2 = zc_get_config(ctrl_sect,"btn_ex2",8); | |
| 434 | 266 | Exbtn3 = zc_get_config(ctrl_sect,"btn_ex3",4); | |
| 435 | 266 | Exbtn4 = zc_get_config(ctrl_sect,"btn_ex4",3); | |
| 436 | |||
| 437 | 266 | DUbtn = zc_get_config(ctrl_sect,"btn_up",13); | |
| 438 | 266 | DDbtn = zc_get_config(ctrl_sect,"btn_down",14); | |
| 439 | 266 | DLbtn = zc_get_config(ctrl_sect,"btn_left",15); | |
| 440 | 266 | DRbtn = zc_get_config(ctrl_sect,"btn_right",16); | |
| 441 | |||
| 442 | 266 | epilepsyFlashReduction = zc_get_config(cfg_sect,"epilepsy_flash_reduction",0); | |
| 443 | |||
| 444 | 266 | midi_volume = zc_get_config(sfx_sect,"midi",255); | |
| 445 | 266 | sfx_volume = zc_get_config(sfx_sect,"sfx",255); | |
| 446 | 266 | emusic_volume = zc_get_config(sfx_sect,"emusic",255); | |
| 447 | 266 | pan_style = zc_get_config(sfx_sect,"pan",1); | |
| 448 | 266 | volkeys = zc_get_config(sfx_sect,"volkeys",0)!=0; | |
| 449 | 266 | zc_vsync = zc_get_config(cfg_sect,"vsync",0); | |
| 450 | 266 | Throttlefps = zc_get_config(cfg_sect,"throttlefps",1)!=0; | |
| 451 | 266 | Maxfps = zc_get_config(cfg_sect,"maxfps",0); | |
| 452 | 266 | TransLayers = zc_get_config(cfg_sect,"translayers",1)!=0; | |
| 453 | 266 | SnapshotFormat = zc_get_config(cfg_sect,"snapshot_format",3); | |
| 454 | 266 | SnapshotScale = zc_get_config(cfg_sect,"snapshot_scale",2); | |
| 455 | 266 | NameEntryMode = zc_get_config(cfg_sect,"name_entry_mode",0); | |
| 456 | #ifdef __EMSCRIPTEN__ | ||
| 457 | if (em_is_mobile()) NameEntryMode = 2; | ||
| 458 | #endif | ||
| 459 | 266 | ShowFPS = zc_get_config(cfg_sect,"showfps",0)!=0; | |
| 460 | 266 | ShowGameTime = zc_get_config(cfg_sect,"showtime",0); | |
| 461 | 266 | NESquit = zc_get_config(cfg_sect,"fastquit",0)!=0; | |
| 462 | 266 | ClickToFreeze = zc_get_config(cfg_sect,"clicktofreeze",1)!=0; | |
| 463 | 266 | abc_patternmatch = zc_get_config(cfg_sect, "lister_pattern_matching", 1); | |
| 464 | 266 | pause_in_background = zc_get_config(cfg_sect, "pause_in_background", 0); | |
| 465 | |||
| 466 | 266 | window_width = resx = zc_get_config(cfg_sect,"window_width",-1); | |
| 467 | 266 | window_height = resy = zc_get_config(cfg_sect,"window_height",-1); | |
| 468 | 266 | SaveDragResize = zc_get_config(cfg_sect,"save_drag_resize",0)!=0; | |
| 469 | 266 | DragAspect = zc_get_config(cfg_sect,"drag_aspect",0)!=0; | |
| 470 | 266 | SaveWinPos = zc_get_config(cfg_sect,"save_window_position",0)!=0; | |
| 471 | 266 | scaleForceInteger = zc_get_config("zeldadx","scaling_force_integer",1)!=0; | |
| 472 | 266 | stretchGame = zc_get_config("zeldadx","stretch_game_area",0)!=0; | |
| 473 | |||
| 474 | 266 | loadlast = zc_get_config(cfg_sect,"load_last",0); | |
| 475 | |||
| 476 | 266 | fullscreen = zc_get_config(cfg_sect,"fullscreen",0); | |
| 477 | |||
| 478 | 266 | info_opacity = zc_get_config("zc","debug_info_opacity",255); | |
| 479 | #ifdef _WIN32 | ||
| 480 | console_enabled = (byte) zc_get_config("CONSOLE", "enabled", 0); | ||
| 481 | //use_win7_keyboard_fix = (byte) zc_get_config(cfg_sect,"use_win7_key_fix",0); | ||
| 482 | use_win32_proc = (byte) zc_get_config(cfg_sect,"zc_win_proc_fix",0); //buggy | ||
| 483 | |||
| 484 | // This one's for Aero | ||
| 485 | use_dwm_flush = (byte) zc_get_config("zeldadx","use_dwm_flush",0); | ||
| 486 | |||
| 487 | monochrome_console = (byte) zc_get_config("CONSOLE","monochrome_debuggers",0); | ||
| 488 | #else //UNIX | ||
| 489 | 266 | console_enabled = (byte) zc_get_config("CONSOLE", "enabled", 0); | |
| 490 | 266 | monochrome_console = (byte) zc_get_config("CONSOLE","monochrome_debuggers",0); | |
| 491 | #endif | ||
| 492 | 266 | clearConsoleOnLoad = zc_get_config("CONSOLE","clear_console_on_load",1)!=0; | |
| 493 | 266 | clearConsoleOnReload = zc_get_config("CONSOLE","clear_console_on_reload",0)!=0; | |
| 494 | |||
| 495 | 266 | strcpy(qstdir,zc_get_config(cfg_sect,"quest_dir","quests")); | |
| 496 | 266 | strcpy(qstpath,qstdir); //qstpath is the local (for this run of ZC) quest path, qstdir is the universal quest dir. | |
| 497 | 266 | ss_enable = zc_get_config(cfg_sect,"ss_enable",1) ? 1 : 0; | |
| 498 | 266 | ss_after = vbound(zc_get_config(cfg_sect,"ss_after",14), 0, 14); | |
| 499 | 266 | ss_speed = vbound(zc_get_config(cfg_sect,"ss_speed",2), 0, 6); | |
| 500 | 266 | ss_density = vbound(zc_get_config(cfg_sect,"ss_density",3), 0, 6); | |
| 501 | 266 | heart_beep = zc_get_config(cfg_sect,"heart_beep",0)!=0; | |
| 502 | //gui_colorset = zc_get_config(cfg_sect,"gui_colorset",0); | ||
| 503 | 266 | sfxdat = zc_get_config(cfg_sect,"use_sfx_dat",1); | |
| 504 | 266 | fullscreen = zc_get_config(cfg_sect,"fullscreen",0); | |
| 505 | 266 | use_save_indicator = zc_get_config(cfg_sect,"save_indicator",0); | |
| 506 | 266 | zc_192b163_warp_compatibility = zc_get_config(cfg_sect,"zc_192b163_warp_compatibility",0); | |
| 507 | 266 | SkipTitle = zc_get_config(cfg_sect,"skip_title",0); | |
| 508 | 266 | } | |
| 509 | |||
| 510 | ✗ | void save_control_configs(bool kb) | |
| 511 | { | ||
| 512 | ✗ | if(kb) | |
| 513 | { | ||
| 514 | ✗ | zc_set_config(ctrl_sect,"key_cheatmod_a1",cheat_modifier_keys[0]); | |
| 515 | ✗ | zc_set_config(ctrl_sect,"key_cheatmod_a2",cheat_modifier_keys[1]); | |
| 516 | ✗ | zc_set_config(ctrl_sect,"key_cheatmod_b1",cheat_modifier_keys[2]); | |
| 517 | ✗ | zc_set_config(ctrl_sect,"key_cheatmod_b2",cheat_modifier_keys[3]); | |
| 518 | |||
| 519 | ✗ | if (!replay_is_replaying()) | |
| 520 | { | ||
| 521 | ✗ | zc_set_config(ctrl_sect,"key_a",Akey); | |
| 522 | ✗ | zc_set_config(ctrl_sect,"key_b",Bkey); | |
| 523 | ✗ | zc_set_config(ctrl_sect,"key_s",Skey); | |
| 524 | ✗ | zc_set_config(ctrl_sect,"key_l",Lkey); | |
| 525 | ✗ | zc_set_config(ctrl_sect,"key_r",Rkey); | |
| 526 | ✗ | zc_set_config(ctrl_sect,"key_p",Pkey); | |
| 527 | ✗ | zc_set_config(ctrl_sect,"key_ex1",Exkey1); | |
| 528 | ✗ | zc_set_config(ctrl_sect,"key_ex2",Exkey2); | |
| 529 | ✗ | zc_set_config(ctrl_sect,"key_ex3",Exkey3); | |
| 530 | ✗ | zc_set_config(ctrl_sect,"key_ex4",Exkey4); | |
| 531 | ✗ | zc_set_config(ctrl_sect,"key_up", DUkey); | |
| 532 | ✗ | zc_set_config(ctrl_sect,"key_down", DDkey); | |
| 533 | ✗ | zc_set_config(ctrl_sect,"key_left", DLkey); | |
| 534 | ✗ | zc_set_config(ctrl_sect,"key_right",DRkey); | |
| 535 | ✗ | } | |
| 536 | ✗ | } | |
| 537 | else | ||
| 538 | { | ||
| 539 | ✗ | zc_set_config(ctrl_sect,"joystick_index",joystick_index); | |
| 540 | ✗ | zc_set_config(ctrl_sect,"js_stick_1_x_stick",js_stick_1_x_stick); | |
| 541 | ✗ | zc_set_config(ctrl_sect,"js_stick_1_x_axis",js_stick_1_x_axis); | |
| 542 | ✗ | zc_set_config(ctrl_sect,"js_stick_1_x_offset",js_stick_1_x_offset ? 1 : 0); | |
| 543 | ✗ | zc_set_config(ctrl_sect,"js_stick_1_y_stick",js_stick_1_y_stick); | |
| 544 | ✗ | zc_set_config(ctrl_sect,"js_stick_1_y_axis",js_stick_1_y_axis); | |
| 545 | ✗ | zc_set_config(ctrl_sect,"js_stick_1_y_offset",js_stick_1_y_offset ? 1 : 0); | |
| 546 | ✗ | zc_set_config(ctrl_sect,"js_stick_2_x_stick",js_stick_2_x_stick); | |
| 547 | ✗ | zc_set_config(ctrl_sect,"js_stick_2_x_axis",js_stick_2_x_axis); | |
| 548 | ✗ | zc_set_config(ctrl_sect,"js_stick_2_x_offset",js_stick_2_x_offset ? 1 : 0); | |
| 549 | ✗ | zc_set_config(ctrl_sect,"js_stick_2_y_stick",js_stick_2_y_stick); | |
| 550 | ✗ | zc_set_config(ctrl_sect,"js_stick_2_y_axis",js_stick_2_y_axis); | |
| 551 | ✗ | zc_set_config(ctrl_sect,"js_stick_2_y_offset",js_stick_2_y_offset ? 1 : 0); | |
| 552 | ✗ | zc_set_config(ctrl_sect,"analog_movement",analog_movement); | |
| 553 | |||
| 554 | ✗ | zc_set_config(ctrl_sect,"btn_a",Abtn); | |
| 555 | ✗ | zc_set_config(ctrl_sect,"btn_b",Bbtn); | |
| 556 | ✗ | zc_set_config(ctrl_sect,"btn_s",Sbtn); | |
| 557 | ✗ | zc_set_config(ctrl_sect,"btn_m",Mbtn); | |
| 558 | ✗ | zc_set_config(ctrl_sect,"btn_l",Lbtn); | |
| 559 | ✗ | zc_set_config(ctrl_sect,"btn_r",Rbtn); | |
| 560 | ✗ | zc_set_config(ctrl_sect,"btn_p",Pbtn); | |
| 561 | ✗ | zc_set_config(ctrl_sect,"btn_ex1",Exbtn1); | |
| 562 | ✗ | zc_set_config(ctrl_sect,"btn_ex2",Exbtn2); | |
| 563 | ✗ | zc_set_config(ctrl_sect,"btn_ex3",Exbtn3); | |
| 564 | ✗ | zc_set_config(ctrl_sect,"btn_ex4",Exbtn4); | |
| 565 | |||
| 566 | ✗ | zc_set_config(ctrl_sect,"btn_up",DUbtn); | |
| 567 | ✗ | zc_set_config(ctrl_sect,"btn_down",DDbtn); | |
| 568 | ✗ | zc_set_config(ctrl_sect,"btn_left",DLbtn); | |
| 569 | ✗ | zc_set_config(ctrl_sect,"btn_right",DRbtn); | |
| 570 | } | ||
| 571 | ✗ | } | |
| 572 | |||
| 573 | ✗ | void save_cheatkeys() | |
| 574 | { | ||
| 575 | char buf[256]; | ||
| 576 | ✗ | for(size_t q = 1; q < Cheat::Last; ++q) | |
| 577 | { | ||
| 578 | ✗ | if(!bindable_cheat((Cheat)q)) continue; | |
| 579 | ✗ | std::string cheatname = cheat_to_string((Cheat)q); | |
| 580 | ✗ | util::lowerstr(cheatname); | |
| 581 | ✗ | sprintf(buf, "key_cheat_%s_main", cheatname.c_str()); | |
| 582 | ✗ | zc_set_config(ctrl_sect,buf,cheatkeys[q][0]); | |
| 583 | ✗ | sprintf(buf, "key_cheat_%s_alt", cheatname.c_str()); | |
| 584 | ✗ | if(cheatkeys[q][1]) | |
| 585 | ✗ | zc_set_config(ctrl_sect,buf,cheatkeys[q][1]); | |
| 586 | ✗ | else zc_set_config(ctrl_sect,buf,(char*)nullptr); | |
| 587 | ✗ | } | |
| 588 | ✗ | } | |
| 589 | |||
| 590 | 266 | void save_game_configs() | |
| 591 | { | ||
| 592 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 266 times.
|
266 | if (!loaded_game_configs) return; |
| 593 | |||
| 594 | 266 | packfile_password(""); | |
| 595 | |||
| 596 | 266 | zc_set_config("ZCMODULE",qst_module_name,moduledata.module_name); | |
| 597 | |||
| 598 |
4/6✓ Branch 0 taken 27 times.
✓ Branch 1 taken 239 times.
✓ Branch 2 taken 27 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 27 times.
|
266 | if (all_get_display() && !all_get_fullscreen_flag()&& SaveWinPos) |
| 599 | { | ||
| 600 | int o_window_x, o_window_y; | ||
| 601 | ✗ | al_get_window_position(all_get_display(), &o_window_x, &o_window_y); | |
| 602 | ✗ | zc_set_config(cfg_sect,"window_x",o_window_x); | |
| 603 | ✗ | zc_set_config(cfg_sect,"window_y",o_window_y); | |
| 604 | ✗ | } | |
| 605 | |||
| 606 |
4/6✓ Branch 0 taken 27 times.
✓ Branch 1 taken 239 times.
✓ Branch 2 taken 27 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 27 times.
|
266 | if (all_get_display() && !all_get_fullscreen_flag() && SaveDragResize) |
| 607 | { | ||
| 608 | ✗ | window_width = al_get_display_width(all_get_display()); | |
| 609 | ✗ | window_height = al_get_display_height(all_get_display()); | |
| 610 | ✗ | zc_set_config(cfg_sect,"window_width",window_width); | |
| 611 | ✗ | zc_set_config(cfg_sect,"window_height",window_height); | |
| 612 | ✗ | } | |
| 613 | |||
| 614 | 266 | zc_set_config(cfg_sect,"load_last",loadlast); | |
| 615 | 266 | zc_set_config(cfg_sect,"use_sfx_dat",sfxdat); | |
| 616 | |||
| 617 | 266 | flush_config_file(); | |
| 618 | #ifdef __EMSCRIPTEN__ | ||
| 619 | em_sync_fs(); | ||
| 620 | #endif | ||
| 621 | 266 | } | |
| 622 | |||
| 623 | //---------------------------------------------------------------- | ||
| 624 | |||
| 625 | // Timers | ||
| 626 | |||
| 627 | 43797 | void fps_callback() | |
| 628 | { | ||
| 629 | 43797 | lastfps=framecnt; | |
| 630 | 43797 | framecnt=0; | |
| 631 | 43797 | } | |
| 632 | |||
| 633 | END_OF_FUNCTION(fps_callback) | ||
| 634 | |||
| 635 | 266 | int32_t Z_init_timers() | |
| 636 | { | ||
| 637 | static bool didit = false; | ||
| 638 | const static char *err_str = "Couldn't allocate timer"; | ||
| 639 | 266 | err_str = err_str; //Unused variable warning | |
| 640 | |||
| 641 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 266 times.
|
266 | if(didit) |
| 642 | ✗ | return 1; | |
| 643 | |||
| 644 | 266 | didit = true; | |
| 645 | |||
| 646 | LOCK_VARIABLE(lastfps); | ||
| 647 | LOCK_VARIABLE(framecnt); | ||
| 648 | LOCK_FUNCTION(fps_callback); | ||
| 649 | |||
| 650 |
1/2✓ Branch 0 taken 266 times.
✗ Branch 1 not taken.
|
266 | if(install_int_ex(fps_callback,SECS_TO_TIMER(1))) |
| 651 | ✗ | return 0; | |
| 652 | |||
| 653 | 266 | return 1; | |
| 654 | 266 | } | |
| 655 | |||
| 656 | 266 | void Z_remove_timers() | |
| 657 | { | ||
| 658 | 266 | remove_int(fps_callback); | |
| 659 | 266 | } | |
| 660 | |||
| 661 | //---------------------------------------------------------------- | ||
| 662 | |||
| 663 | ✗ | void go() | |
| 664 | { | ||
| 665 | ✗ | blit(screen,tmp_scr,scrx,scry,0,0,screen->w,screen->h); | |
| 666 | ✗ | } | |
| 667 | |||
| 668 | ✗ | void comeback() | |
| 669 | { | ||
| 670 | ✗ | blit(tmp_scr,screen,0,0,scrx,scry,screen->w,screen->h); | |
| 671 | ✗ | } | |
| 672 | |||
| 673 | ✗ | void dump_pal(BITMAP *dest) | |
| 674 | { | ||
| 675 | ✗ | for(int32_t i=0; i<256; i++) | |
| 676 | ✗ | rectfill(dest,(i&63)<<2,(i&0xFC0)>>4,((i&63)<<2)+3,((i&0xFC0)>>4)+3,i); | |
| 677 | ✗ | } | |
| 678 | |||
| 679 | //---------------------------------------------------------------- | ||
| 680 | |||
| 681 | int game_mouse_index = ZCM_BLANK; | ||
| 682 | static bool system_mouse = false; | ||
| 683 | 176 | bool sys_mouse() | |
| 684 | { | ||
| 685 | 176 | system_mouse = true; | |
| 686 | 176 | return MouseSprite::set(ZCM_NORMAL); | |
| 687 | } | ||
| 688 | 1571 | bool game_mouse() | |
| 689 | { | ||
| 690 | 1571 | system_mouse = false; | |
| 691 | 1571 | return MouseSprite::set(game_mouse_index); | |
| 692 | } | ||
| 693 | ✗ | void custom_mouse(BITMAP* bmp, int fx, int fy, bool sys_recolor, bool user_scale) | |
| 694 | { | ||
| 695 | ✗ | if(!bmp) | |
| 696 | ✗ | return; | |
| 697 | ✗ | float scale = vbound(zc_get_config("zeldadx","cursor_scale_large",1.5),1.0,5.0); | |
| 698 | ✗ | int scaledw = bmp->w*scale, scaledh = bmp->h*scale; | |
| 699 | ✗ | if(bmp->w == scaledw && bmp->h == scaledh) | |
| 700 | ✗ | user_scale = false; | |
| 701 | ✗ | if(user_scale || sys_recolor) | |
| 702 | { | ||
| 703 | ✗ | if(!user_scale) scale = 1; | |
| 704 | ✗ | BITMAP* tmpbmp = create_bitmap_ex(8,bmp->w*scale,bmp->h*scale); | |
| 705 | ✗ | if(user_scale) | |
| 706 | ✗ | stretch_blit(bmp, tmpbmp, 0, 0, bmp->w, bmp->h, 0, 0, tmpbmp->w, tmpbmp->h); | |
| 707 | else | ||
| 708 | ✗ | blit(bmp, tmpbmp, 0, 0, 0, 0, bmp->w, bmp->h); | |
| 709 | ✗ | if(sys_recolor) | |
| 710 | ✗ | recolor_mouse(tmpbmp); | |
| 711 | ✗ | MouseSprite::assign(ZCM_CUSTOM, tmpbmp, fx*scale, fy*scale); | |
| 712 | ✗ | destroy_bitmap(tmpbmp); | |
| 713 | ✗ | } | |
| 714 | else | ||
| 715 | { | ||
| 716 | ✗ | MouseSprite::assign(ZCM_CUSTOM, bmp, fx, fy); | |
| 717 | } | ||
| 718 | ✗ | } | |
| 719 | |||
| 720 | //Handles converting the mouse sprite from the .dat file | ||
| 721 | 27 | void recolor_mouse(BITMAP* bmp) | |
| 722 | { | ||
| 723 |
2/2✓ Branch 0 taken 432 times.
✓ Branch 1 taken 27 times.
|
459 | for(int32_t x = 0; x < bmp->w; ++x) |
| 724 | { | ||
| 725 |
2/2✓ Branch 0 taken 6912 times.
✓ Branch 1 taken 432 times.
|
7344 | for(int32_t y = 0; y < bmp->h; ++y) |
| 726 | { | ||
| 727 | 6912 | int32_t color = getpixel(bmp, x, y); | |
| 728 |
5/5✓ Branch 0 taken 4698 times.
✓ Branch 1 taken 513 times.
✓ Branch 2 taken 594 times.
✓ Branch 3 taken 621 times.
✓ Branch 4 taken 486 times.
|
6912 | switch(color) |
| 729 | { | ||
| 730 | case dvc(1): | ||
| 731 | 513 | color = jwin_pal[jcCURSORMISC]; | |
| 732 | 513 | break; | |
| 733 | case dvc(2): | ||
| 734 | 594 | color = jwin_pal[jcCURSOROUTLINE]; | |
| 735 | 594 | break; | |
| 736 | case dvc(3): | ||
| 737 | 621 | color = jwin_pal[jcCURSORLIGHT]; | |
| 738 | 621 | break; | |
| 739 | case dvc(5): | ||
| 740 | 486 | color = jwin_pal[jcCURSORDARK]; | |
| 741 | 486 | break; | |
| 742 | default: | ||
| 743 | 4698 | continue; | |
| 744 | } | ||
| 745 | 2214 | putpixel(bmp, x, y, color); | |
| 746 | 2214 | } | |
| 747 | 432 | } | |
| 748 | 27 | } | |
| 749 | 27 | void load_mouse() | |
| 750 | { | ||
| 751 | PALETTE pal; | ||
| 752 | 27 | BITMAP* cursor_bitmap = load_bitmap("assets/cursor.bmp", pal); | |
| 753 |
1/2✓ Branch 0 taken 27 times.
✗ Branch 1 not taken.
|
27 | if (!cursor_bitmap) |
| 754 | ✗ | Z_error_fatal("Missing required file %s\n", "assets/cursor.bmp"); | |
| 755 | |||
| 756 | 27 | enter_sys_pal(); | |
| 757 | 27 | MouseSprite::set(-1); | |
| 758 | 27 | float scale = vbound(zc_get_config("zeldadx","cursor_scale_large",1.5),1.0,5.0); | |
| 759 | 27 | int32_t sz = 16*scale; | |
| 760 |
2/2✓ Branch 0 taken 27 times.
✓ Branch 1 taken 27 times.
|
54 | for(int32_t j = 0; j < 1; ++j) |
| 761 | { | ||
| 762 | 27 | BITMAP* tmpbmp = create_bitmap_ex(8,16,16); | |
| 763 |
1/2✓ Branch 0 taken 27 times.
✗ Branch 1 not taken.
|
27 | if(zcmouse[j]) |
| 764 | ✗ | destroy_bitmap(zcmouse[j]); | |
| 765 | 27 | zcmouse[j] = create_bitmap_ex(8,sz,sz); | |
| 766 | 27 | clear_bitmap(zcmouse[j]); | |
| 767 | 27 | clear_bitmap(tmpbmp); | |
| 768 | 27 | blit(cursor_bitmap,tmpbmp,1,j*17+1,0,0,16,16); | |
| 769 | 27 | recolor_mouse(tmpbmp); | |
| 770 |
1/2✓ Branch 0 taken 27 times.
✗ Branch 1 not taken.
|
27 | if(sz!=16) |
| 771 | 27 | stretch_blit(tmpbmp, zcmouse[j], 0, 0, 16, 16, 0, 0, sz, sz); | |
| 772 | else | ||
| 773 | ✗ | blit(tmpbmp, zcmouse[j], 0, 0, 0, 0, 16, 16); | |
| 774 | 27 | destroy_bitmap(tmpbmp); | |
| 775 | 27 | } | |
| 776 |
1/2✓ Branch 0 taken 27 times.
✗ Branch 1 not taken.
|
27 | if(!hw_palette) hw_palette = &RAMpal; |
| 777 | 27 | zc_set_palette(*hw_palette); | |
| 778 | |||
| 779 | 27 | BITMAP* blankmouse = create_bitmap_ex(8,16,16); | |
| 780 | 27 | clear_bitmap(blankmouse); | |
| 781 | |||
| 782 | 27 | MouseSprite::assign(ZCM_NORMAL, zcmouse[0], 1*scale, 1*scale); | |
| 783 | 27 | MouseSprite::assign(ZCM_BLANK, blankmouse); | |
| 784 | //Don't assign ZCM_CUSTOM. That'll be handled by scripts. | ||
| 785 | |||
| 786 | //Reload the mouse | ||
| 787 |
1/2✓ Branch 0 taken 27 times.
✗ Branch 1 not taken.
|
27 | if(system_mouse) |
| 788 | 27 | sys_mouse(); | |
| 789 | ✗ | else game_mouse(); | |
| 790 | |||
| 791 | 27 | destroy_bitmap(blankmouse); | |
| 792 | 27 | destroy_bitmap(cursor_bitmap); | |
| 793 | 27 | exit_sys_pal(); | |
| 794 | 27 | } | |
| 795 | |||
| 796 | // sets the video mode and initializes the palette and mouse sprite | ||
| 797 | 266 | bool game_vid_mode(int32_t mode,int32_t wait) | |
| 798 | { | ||
| 799 |
2/2✓ Branch 0 taken 239 times.
✓ Branch 1 taken 27 times.
|
266 | if (is_headless()) |
| 800 | 239 | return true; | |
| 801 | |||
| 802 | extern int zq_screen_w, zq_screen_h; | ||
| 803 |
1/2✓ Branch 0 taken 27 times.
✗ Branch 1 not taken.
|
27 | if(set_gfx_mode(mode,resx,resy,zq_screen_w,zq_screen_h)!=0) |
| 804 | { | ||
| 805 | ✗ | return false; | |
| 806 | } | ||
| 807 | |||
| 808 | 27 | scrx = (resx-320)>>1; | |
| 809 | 27 | scry = (resy-240)>>1; | |
| 810 |
2/2✓ Branch 0 taken 27 times.
✓ Branch 1 taken 27 times.
|
54 | for(int32_t q = 0; q < NUM_ZCMOUSE; ++q) |
| 811 | 27 | zcmouse[q] = NULL; | |
| 812 | 27 | load_mouse(); | |
| 813 | |||
| 814 |
2/2✓ Branch 0 taken 432 times.
✓ Branch 1 taken 27 times.
|
459 | for(int32_t i=240; i<256; i++) |
| 815 | 432 | RAMpal[i]=pal_gui[i]; | |
| 816 | |||
| 817 | 27 | zc_set_palette(RAMpal); | |
| 818 | 27 | clear_to_color(screen,BLACK); | |
| 819 | |||
| 820 | 27 | rest(wait); | |
| 821 | 27 | return true; | |
| 822 | 266 | } | |
| 823 | |||
| 824 | 275 | void null_quest() | |
| 825 | { | ||
| 826 | char qstdat_string[2048]; | ||
| 827 | 275 | strcpy(qstdat_string, "modules/classic/default.qst"); | |
| 828 | |||
| 829 | #ifdef __EMSCRIPTEN__ | ||
| 830 | // The quest template data file is not included because it's really big and isn't really needed | ||
| 831 | // for the player, except to initialize some graphics. Those same graphics exist in this quest file, | ||
| 832 | // which is much smaller. | ||
| 833 | strcpy(qstdat_string, "modules/classic/title_gfx.dat"); | ||
| 834 | #endif | ||
| 835 | |||
| 836 | 275 | byte skip_flags[4] = { 0 }; | |
| 837 | |||
| 838 | 275 | loadquest(qstdat_string,&QHeader,&QMisc,tunes+ZC_MIDI_COUNT,false,skip_flags,0,false); | |
| 839 | 275 | } | |
| 840 | |||
| 841 | 275 | void init_NES_mode() | |
| 842 | { | ||
| 843 | 275 | null_quest(); | |
| 844 | 275 | } | |
| 845 | |||
| 846 | //---------------------------------------------------------------- | ||
| 847 | |||
| 848 | qword trianglelines[16]= | ||
| 849 | { | ||
| 850 | 0x0000000000000000ULL, | ||
| 851 | 0xFD00000000000000ULL, | ||
| 852 | 0xFDFD000000000000ULL, | ||
| 853 | 0xFDFDFD0000000000ULL, | ||
| 854 | 0xFDFDFDFD00000000ULL, | ||
| 855 | 0xFDFDFDFDFD000000ULL, | ||
| 856 | 0xFDFDFDFDFDFD0000ULL, | ||
| 857 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 858 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 859 | 0x00FDFDFDFDFDFDFDULL, | ||
| 860 | 0x0000FDFDFDFDFDFDULL, | ||
| 861 | 0x000000FDFDFDFDFDULL, | ||
| 862 | 0x00000000FDFDFDFDULL, | ||
| 863 | 0x0000000000FDFDFDULL, | ||
| 864 | 0x000000000000FDFDULL, | ||
| 865 | 0x00000000000000FDULL, | ||
| 866 | }; | ||
| 867 | |||
| 868 | word screen_triangles[28][32]; | ||
| 869 | |||
| 870 | // the ULL suffixes are to prevent this warning: | ||
| 871 | // warning: integer constant is too large for "int32_t" type | ||
| 872 | |||
| 873 | qword triangles[4][16][8]= //[direction][value][line] | ||
| 874 | { | ||
| 875 | { | ||
| 876 | { | ||
| 877 | 0x0000000000000000ULL, | ||
| 878 | 0x0000000000000000ULL, | ||
| 879 | 0x0000000000000000ULL, | ||
| 880 | 0x0000000000000000ULL, | ||
| 881 | 0x0000000000000000ULL, | ||
| 882 | 0x0000000000000000ULL, | ||
| 883 | 0x0000000000000000ULL, | ||
| 884 | 0x0000000000000000ULL | ||
| 885 | }, | ||
| 886 | { | ||
| 887 | 0xFD00000000000000ULL, | ||
| 888 | 0x0000000000000000ULL, | ||
| 889 | 0x0000000000000000ULL, | ||
| 890 | 0x0000000000000000ULL, | ||
| 891 | 0x0000000000000000ULL, | ||
| 892 | 0x0000000000000000ULL, | ||
| 893 | 0x0000000000000000ULL, | ||
| 894 | 0x0000000000000000ULL | ||
| 895 | }, | ||
| 896 | { | ||
| 897 | 0xFDFD000000000000ULL, | ||
| 898 | 0xFD00000000000000ULL, | ||
| 899 | 0x0000000000000000ULL, | ||
| 900 | 0x0000000000000000ULL, | ||
| 901 | 0x0000000000000000ULL, | ||
| 902 | 0x0000000000000000ULL, | ||
| 903 | 0x0000000000000000ULL, | ||
| 904 | 0x0000000000000000ULL | ||
| 905 | }, | ||
| 906 | { | ||
| 907 | 0xFDFDFD0000000000ULL, | ||
| 908 | 0xFDFD000000000000ULL, | ||
| 909 | 0xFD00000000000000ULL, | ||
| 910 | 0x0000000000000000ULL, | ||
| 911 | 0x0000000000000000ULL, | ||
| 912 | 0x0000000000000000ULL, | ||
| 913 | 0x0000000000000000ULL, | ||
| 914 | 0x0000000000000000ULL | ||
| 915 | }, | ||
| 916 | { | ||
| 917 | 0xFDFDFDFD00000000ULL, | ||
| 918 | 0xFDFDFD0000000000ULL, | ||
| 919 | 0xFDFD000000000000ULL, | ||
| 920 | 0xFD00000000000000ULL, | ||
| 921 | 0x0000000000000000ULL, | ||
| 922 | 0x0000000000000000ULL, | ||
| 923 | 0x0000000000000000ULL, | ||
| 924 | 0x0000000000000000ULL | ||
| 925 | }, | ||
| 926 | { | ||
| 927 | 0xFDFDFDFDFD000000ULL, | ||
| 928 | 0xFDFDFDFD00000000ULL, | ||
| 929 | 0xFDFDFD0000000000ULL, | ||
| 930 | 0xFDFD000000000000ULL, | ||
| 931 | 0xFD00000000000000ULL, | ||
| 932 | 0x0000000000000000ULL, | ||
| 933 | 0x0000000000000000ULL, | ||
| 934 | 0x0000000000000000ULL | ||
| 935 | }, | ||
| 936 | { | ||
| 937 | 0xFDFDFDFDFDFD0000ULL, | ||
| 938 | 0xFDFDFDFDFD000000ULL, | ||
| 939 | 0xFDFDFDFD00000000ULL, | ||
| 940 | 0xFDFDFD0000000000ULL, | ||
| 941 | 0xFDFD000000000000ULL, | ||
| 942 | 0xFD00000000000000ULL, | ||
| 943 | 0x0000000000000000ULL, | ||
| 944 | 0x0000000000000000ULL | ||
| 945 | }, | ||
| 946 | { | ||
| 947 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 948 | 0xFDFDFDFDFDFD0000ULL, | ||
| 949 | 0xFDFDFDFDFD000000ULL, | ||
| 950 | 0xFDFDFDFD00000000ULL, | ||
| 951 | 0xFDFDFD0000000000ULL, | ||
| 952 | 0xFDFD000000000000ULL, | ||
| 953 | 0xFD00000000000000ULL, | ||
| 954 | 0x0000000000000000ULL | ||
| 955 | }, | ||
| 956 | { | ||
| 957 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 958 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 959 | 0xFDFDFDFDFDFD0000ULL, | ||
| 960 | 0xFDFDFDFDFD000000ULL, | ||
| 961 | 0xFDFDFDFD00000000ULL, | ||
| 962 | 0xFDFDFD0000000000ULL, | ||
| 963 | 0xFDFD000000000000ULL, | ||
| 964 | 0xFD00000000000000ULL | ||
| 965 | }, | ||
| 966 | { | ||
| 967 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 968 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 969 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 970 | 0xFDFDFDFDFDFD0000ULL, | ||
| 971 | 0xFDFDFDFDFD000000ULL, | ||
| 972 | 0xFDFDFDFD00000000ULL, | ||
| 973 | 0xFDFDFD0000000000ULL, | ||
| 974 | 0xFDFD000000000000ULL | ||
| 975 | }, | ||
| 976 | { | ||
| 977 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 978 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 979 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 980 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 981 | 0xFDFDFDFDFDFD0000ULL, | ||
| 982 | 0xFDFDFDFDFD000000ULL, | ||
| 983 | 0xFDFDFDFD00000000ULL, | ||
| 984 | 0xFDFDFD0000000000ULL | ||
| 985 | }, | ||
| 986 | { | ||
| 987 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 988 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 989 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 990 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 991 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 992 | 0xFDFDFDFDFDFD0000ULL, | ||
| 993 | 0xFDFDFDFDFD000000ULL, | ||
| 994 | 0xFDFDFDFD00000000ULL | ||
| 995 | }, | ||
| 996 | { | ||
| 997 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 998 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 999 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1000 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1001 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1002 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 1003 | 0xFDFDFDFDFDFD0000ULL, | ||
| 1004 | 0xFDFDFDFDFD000000ULL | ||
| 1005 | }, | ||
| 1006 | { | ||
| 1007 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1008 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1009 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1010 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1011 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1012 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1013 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 1014 | 0xFDFDFDFDFDFD0000ULL | ||
| 1015 | }, | ||
| 1016 | { | ||
| 1017 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1018 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1019 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1020 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1021 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1022 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1023 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1024 | 0xFDFDFDFDFDFDFD00ULL | ||
| 1025 | }, | ||
| 1026 | { | ||
| 1027 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1028 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1029 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1030 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1031 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1032 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1033 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1034 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1035 | } | ||
| 1036 | }, | ||
| 1037 | { | ||
| 1038 | { | ||
| 1039 | 0x0000000000000000ULL, | ||
| 1040 | 0x0000000000000000ULL, | ||
| 1041 | 0x0000000000000000ULL, | ||
| 1042 | 0x0000000000000000ULL, | ||
| 1043 | 0x0000000000000000ULL, | ||
| 1044 | 0x0000000000000000ULL, | ||
| 1045 | 0x0000000000000000ULL, | ||
| 1046 | 0x0000000000000000ULL | ||
| 1047 | }, | ||
| 1048 | { | ||
| 1049 | 0x00000000000000FDULL, | ||
| 1050 | 0x0000000000000000ULL, | ||
| 1051 | 0x0000000000000000ULL, | ||
| 1052 | 0x0000000000000000ULL, | ||
| 1053 | 0x0000000000000000ULL, | ||
| 1054 | 0x0000000000000000ULL, | ||
| 1055 | 0x0000000000000000ULL, | ||
| 1056 | 0x0000000000000000ULL | ||
| 1057 | }, | ||
| 1058 | { | ||
| 1059 | 0x000000000000FDFDULL, | ||
| 1060 | 0x00000000000000FDULL, | ||
| 1061 | 0x0000000000000000ULL, | ||
| 1062 | 0x0000000000000000ULL, | ||
| 1063 | 0x0000000000000000ULL, | ||
| 1064 | 0x0000000000000000ULL, | ||
| 1065 | 0x0000000000000000ULL, | ||
| 1066 | 0x0000000000000000ULL | ||
| 1067 | }, | ||
| 1068 | { | ||
| 1069 | 0x0000000000FDFDFDULL, | ||
| 1070 | 0x000000000000FDFDULL, | ||
| 1071 | 0x00000000000000FDULL, | ||
| 1072 | 0x0000000000000000ULL, | ||
| 1073 | 0x0000000000000000ULL, | ||
| 1074 | 0x0000000000000000ULL, | ||
| 1075 | 0x0000000000000000ULL, | ||
| 1076 | 0x0000000000000000ULL | ||
| 1077 | }, | ||
| 1078 | { | ||
| 1079 | 0x00000000FDFDFDFDULL, | ||
| 1080 | 0x0000000000FDFDFDULL, | ||
| 1081 | 0x000000000000FDFDULL, | ||
| 1082 | 0x00000000000000FDULL, | ||
| 1083 | 0x0000000000000000ULL, | ||
| 1084 | 0x0000000000000000ULL, | ||
| 1085 | 0x0000000000000000ULL, | ||
| 1086 | 0x0000000000000000ULL | ||
| 1087 | }, | ||
| 1088 | { | ||
| 1089 | 0x000000FDFDFDFDFDULL, | ||
| 1090 | 0x00000000FDFDFDFDULL, | ||
| 1091 | 0x0000000000FDFDFDULL, | ||
| 1092 | 0x000000000000FDFDULL, | ||
| 1093 | 0x00000000000000FDULL, | ||
| 1094 | 0x0000000000000000ULL, | ||
| 1095 | 0x0000000000000000ULL, | ||
| 1096 | 0x0000000000000000ULL | ||
| 1097 | }, | ||
| 1098 | { | ||
| 1099 | 0x0000FDFDFDFDFDFDULL, | ||
| 1100 | 0x000000FDFDFDFDFDULL, | ||
| 1101 | 0x00000000FDFDFDFDULL, | ||
| 1102 | 0x0000000000FDFDFDULL, | ||
| 1103 | 0x000000000000FDFDULL, | ||
| 1104 | 0x00000000000000FDULL, | ||
| 1105 | 0x0000000000000000ULL, | ||
| 1106 | 0x0000000000000000ULL | ||
| 1107 | }, | ||
| 1108 | { | ||
| 1109 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1110 | 0x0000FDFDFDFDFDFDULL, | ||
| 1111 | 0x000000FDFDFDFDFDULL, | ||
| 1112 | 0x00000000FDFDFDFDULL, | ||
| 1113 | 0x0000000000FDFDFDULL, | ||
| 1114 | 0x000000000000FDFDULL, | ||
| 1115 | 0x00000000000000FDULL, | ||
| 1116 | 0x0000000000000000ULL | ||
| 1117 | }, | ||
| 1118 | { | ||
| 1119 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1120 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1121 | 0x0000FDFDFDFDFDFDULL, | ||
| 1122 | 0x000000FDFDFDFDFDULL, | ||
| 1123 | 0x00000000FDFDFDFDULL, | ||
| 1124 | 0x0000000000FDFDFDULL, | ||
| 1125 | 0x000000000000FDFDULL, | ||
| 1126 | 0x00000000000000FDULL | ||
| 1127 | }, | ||
| 1128 | { | ||
| 1129 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1130 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1131 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1132 | 0x0000FDFDFDFDFDFDULL, | ||
| 1133 | 0x000000FDFDFDFDFDULL, | ||
| 1134 | 0x00000000FDFDFDFDULL, | ||
| 1135 | 0x0000000000FDFDFDULL, | ||
| 1136 | 0x000000000000FDFDULL | ||
| 1137 | }, | ||
| 1138 | { | ||
| 1139 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1140 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1141 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1142 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1143 | 0x0000FDFDFDFDFDFDULL, | ||
| 1144 | 0x000000FDFDFDFDFDULL, | ||
| 1145 | 0x00000000FDFDFDFDULL, | ||
| 1146 | 0x0000000000FDFDFDULL | ||
| 1147 | }, | ||
| 1148 | { | ||
| 1149 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1150 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1151 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1152 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1153 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1154 | 0x0000FDFDFDFDFDFDULL, | ||
| 1155 | 0x000000FDFDFDFDFDULL, | ||
| 1156 | 0x00000000FDFDFDFDULL | ||
| 1157 | }, | ||
| 1158 | { | ||
| 1159 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1160 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1161 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1162 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1163 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1164 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1165 | 0x0000FDFDFDFDFDFDULL, | ||
| 1166 | 0x000000FDFDFDFDFDULL | ||
| 1167 | }, | ||
| 1168 | { | ||
| 1169 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1170 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1171 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1172 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1173 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1174 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1175 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1176 | 0x0000FDFDFDFDFDFDULL | ||
| 1177 | }, | ||
| 1178 | { | ||
| 1179 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1180 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1181 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1182 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1183 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1184 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1185 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1186 | 0x00FDFDFDFDFDFDFDULL | ||
| 1187 | }, | ||
| 1188 | { | ||
| 1189 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1190 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1191 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1192 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1193 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1194 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1195 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1196 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1197 | } | ||
| 1198 | }, | ||
| 1199 | { | ||
| 1200 | { | ||
| 1201 | 0x0000000000000000ULL, | ||
| 1202 | 0x0000000000000000ULL, | ||
| 1203 | 0x0000000000000000ULL, | ||
| 1204 | 0x0000000000000000ULL, | ||
| 1205 | 0x0000000000000000ULL, | ||
| 1206 | 0x0000000000000000ULL, | ||
| 1207 | 0x0000000000000000ULL, | ||
| 1208 | 0x0000000000000000ULL | ||
| 1209 | }, | ||
| 1210 | { | ||
| 1211 | 0x0000000000000000ULL, | ||
| 1212 | 0x0000000000000000ULL, | ||
| 1213 | 0x0000000000000000ULL, | ||
| 1214 | 0x0000000000000000ULL, | ||
| 1215 | 0x0000000000000000ULL, | ||
| 1216 | 0x0000000000000000ULL, | ||
| 1217 | 0x0000000000000000ULL, | ||
| 1218 | 0xFD00000000000000ULL | ||
| 1219 | }, | ||
| 1220 | { | ||
| 1221 | 0x0000000000000000ULL, | ||
| 1222 | 0x0000000000000000ULL, | ||
| 1223 | 0x0000000000000000ULL, | ||
| 1224 | 0x0000000000000000ULL, | ||
| 1225 | 0x0000000000000000ULL, | ||
| 1226 | 0x0000000000000000ULL, | ||
| 1227 | 0xFD00000000000000ULL, | ||
| 1228 | 0xFDFD000000000000ULL | ||
| 1229 | }, | ||
| 1230 | { | ||
| 1231 | 0x0000000000000000ULL, | ||
| 1232 | 0x0000000000000000ULL, | ||
| 1233 | 0x0000000000000000ULL, | ||
| 1234 | 0x0000000000000000ULL, | ||
| 1235 | 0x0000000000000000ULL, | ||
| 1236 | 0xFD00000000000000ULL, | ||
| 1237 | 0xFDFD000000000000ULL, | ||
| 1238 | 0xFDFDFD0000000000ULL | ||
| 1239 | }, | ||
| 1240 | { | ||
| 1241 | 0x0000000000000000ULL, | ||
| 1242 | 0x0000000000000000ULL, | ||
| 1243 | 0x0000000000000000ULL, | ||
| 1244 | 0x0000000000000000ULL, | ||
| 1245 | 0xFD00000000000000ULL, | ||
| 1246 | 0xFDFD000000000000ULL, | ||
| 1247 | 0xFDFDFD0000000000ULL, | ||
| 1248 | 0xFDFDFDFD00000000ULL | ||
| 1249 | }, | ||
| 1250 | { | ||
| 1251 | 0x0000000000000000ULL, | ||
| 1252 | 0x0000000000000000ULL, | ||
| 1253 | 0x0000000000000000ULL, | ||
| 1254 | 0xFD00000000000000ULL, | ||
| 1255 | 0xFDFD000000000000ULL, | ||
| 1256 | 0xFDFDFD0000000000ULL, | ||
| 1257 | 0xFDFDFDFD00000000ULL, | ||
| 1258 | 0xFDFDFDFDFD000000ULL | ||
| 1259 | }, | ||
| 1260 | { | ||
| 1261 | 0x0000000000000000ULL, | ||
| 1262 | 0x0000000000000000ULL, | ||
| 1263 | 0xFD00000000000000ULL, | ||
| 1264 | 0xFDFD000000000000ULL, | ||
| 1265 | 0xFDFDFD0000000000ULL, | ||
| 1266 | 0xFDFDFDFD00000000ULL, | ||
| 1267 | 0xFDFDFDFDFD000000ULL, | ||
| 1268 | 0xFDFDFDFDFDFD0000ULL | ||
| 1269 | }, | ||
| 1270 | { | ||
| 1271 | 0x0000000000000000ULL, | ||
| 1272 | 0xFD00000000000000ULL, | ||
| 1273 | 0xFDFD000000000000ULL, | ||
| 1274 | 0xFDFDFD0000000000ULL, | ||
| 1275 | 0xFDFDFDFD00000000ULL, | ||
| 1276 | 0xFDFDFDFDFD000000ULL, | ||
| 1277 | 0xFDFDFDFDFDFD0000ULL, | ||
| 1278 | 0xFDFDFDFDFDFDFD00ULL | ||
| 1279 | }, | ||
| 1280 | { | ||
| 1281 | 0xFD00000000000000ULL, | ||
| 1282 | 0xFDFD000000000000ULL, | ||
| 1283 | 0xFDFDFD0000000000ULL, | ||
| 1284 | 0xFDFDFDFD00000000ULL, | ||
| 1285 | 0xFDFDFDFDFD000000ULL, | ||
| 1286 | 0xFDFDFDFDFDFD0000ULL, | ||
| 1287 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 1288 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1289 | }, | ||
| 1290 | { | ||
| 1291 | 0xFDFD000000000000ULL, | ||
| 1292 | 0xFDFDFD0000000000ULL, | ||
| 1293 | 0xFDFDFDFD00000000ULL, | ||
| 1294 | 0xFDFDFDFDFD000000ULL, | ||
| 1295 | 0xFDFDFDFDFDFD0000ULL, | ||
| 1296 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 1297 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1298 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1299 | }, | ||
| 1300 | { | ||
| 1301 | 0xFDFDFD0000000000ULL, | ||
| 1302 | 0xFDFDFDFD00000000ULL, | ||
| 1303 | 0xFDFDFDFDFD000000ULL, | ||
| 1304 | 0xFDFDFDFDFDFD0000ULL, | ||
| 1305 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 1306 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1307 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1308 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1309 | }, | ||
| 1310 | { | ||
| 1311 | 0xFDFDFDFD00000000ULL, | ||
| 1312 | 0xFDFDFDFDFD000000ULL, | ||
| 1313 | 0xFDFDFDFDFDFD0000ULL, | ||
| 1314 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 1315 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1316 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1317 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1318 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1319 | }, | ||
| 1320 | { | ||
| 1321 | 0xFDFDFDFDFD000000ULL, | ||
| 1322 | 0xFDFDFDFDFDFD0000ULL, | ||
| 1323 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 1324 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1325 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1326 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1327 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1328 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1329 | }, | ||
| 1330 | { | ||
| 1331 | 0xFDFDFDFDFDFD0000ULL, | ||
| 1332 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 1333 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1334 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1335 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1336 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1337 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1338 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1339 | }, | ||
| 1340 | { | ||
| 1341 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 1342 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1343 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1344 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1345 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1346 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1347 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1348 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1349 | }, | ||
| 1350 | { | ||
| 1351 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1352 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1353 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1354 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1355 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1356 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1357 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1358 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1359 | } | ||
| 1360 | }, | ||
| 1361 | { | ||
| 1362 | { | ||
| 1363 | 0x0000000000000000ULL, | ||
| 1364 | 0x0000000000000000ULL, | ||
| 1365 | 0x0000000000000000ULL, | ||
| 1366 | 0x0000000000000000ULL, | ||
| 1367 | 0x0000000000000000ULL, | ||
| 1368 | 0x0000000000000000ULL, | ||
| 1369 | 0x0000000000000000ULL, | ||
| 1370 | 0x0000000000000000ULL | ||
| 1371 | }, | ||
| 1372 | { | ||
| 1373 | 0x0000000000000000ULL, | ||
| 1374 | 0x0000000000000000ULL, | ||
| 1375 | 0x0000000000000000ULL, | ||
| 1376 | 0x0000000000000000ULL, | ||
| 1377 | 0x0000000000000000ULL, | ||
| 1378 | 0x0000000000000000ULL, | ||
| 1379 | 0x0000000000000000ULL, | ||
| 1380 | 0x00000000000000FDULL | ||
| 1381 | }, | ||
| 1382 | { | ||
| 1383 | 0x0000000000000000ULL, | ||
| 1384 | 0x0000000000000000ULL, | ||
| 1385 | 0x0000000000000000ULL, | ||
| 1386 | 0x0000000000000000ULL, | ||
| 1387 | 0x0000000000000000ULL, | ||
| 1388 | 0x0000000000000000ULL, | ||
| 1389 | 0x00000000000000FDULL, | ||
| 1390 | 0x000000000000FDFDULL | ||
| 1391 | }, | ||
| 1392 | { | ||
| 1393 | 0x0000000000000000ULL, | ||
| 1394 | 0x0000000000000000ULL, | ||
| 1395 | 0x0000000000000000ULL, | ||
| 1396 | 0x0000000000000000ULL, | ||
| 1397 | 0x0000000000000000ULL, | ||
| 1398 | 0x00000000000000FDULL, | ||
| 1399 | 0x000000000000FDFDULL, | ||
| 1400 | 0x0000000000FDFDFDULL | ||
| 1401 | }, | ||
| 1402 | { | ||
| 1403 | 0x0000000000000000ULL, | ||
| 1404 | 0x0000000000000000ULL, | ||
| 1405 | 0x0000000000000000ULL, | ||
| 1406 | 0x0000000000000000ULL, | ||
| 1407 | 0x00000000000000FDULL, | ||
| 1408 | 0x000000000000FDFDULL, | ||
| 1409 | 0x0000000000FDFDFDULL, | ||
| 1410 | 0x00000000FDFDFDFDULL | ||
| 1411 | }, | ||
| 1412 | { | ||
| 1413 | 0x0000000000000000ULL, | ||
| 1414 | 0x0000000000000000ULL, | ||
| 1415 | 0x0000000000000000ULL, | ||
| 1416 | 0x00000000000000FDULL, | ||
| 1417 | 0x000000000000FDFDULL, | ||
| 1418 | 0x0000000000FDFDFDULL, | ||
| 1419 | 0x00000000FDFDFDFDULL, | ||
| 1420 | 0x000000FDFDFDFDFDULL | ||
| 1421 | }, | ||
| 1422 | { | ||
| 1423 | 0x0000000000000000ULL, | ||
| 1424 | 0x0000000000000000ULL, | ||
| 1425 | 0x00000000000000FDULL, | ||
| 1426 | 0x000000000000FDFDULL, | ||
| 1427 | 0x0000000000FDFDFDULL, | ||
| 1428 | 0x00000000FDFDFDFDULL, | ||
| 1429 | 0x000000FDFDFDFDFDULL, | ||
| 1430 | 0x0000FDFDFDFDFDFDULL | ||
| 1431 | }, | ||
| 1432 | { | ||
| 1433 | 0x0000000000000000ULL, | ||
| 1434 | 0x00000000000000FDULL, | ||
| 1435 | 0x000000000000FDFDULL, | ||
| 1436 | 0x0000000000FDFDFDULL, | ||
| 1437 | 0x00000000FDFDFDFDULL, | ||
| 1438 | 0x000000FDFDFDFDFDULL, | ||
| 1439 | 0x0000FDFDFDFDFDFDULL, | ||
| 1440 | 0x00FDFDFDFDFDFDFDULL | ||
| 1441 | }, | ||
| 1442 | { | ||
| 1443 | 0x00000000000000FDULL, | ||
| 1444 | 0x000000000000FDFDULL, | ||
| 1445 | 0x0000000000FDFDFDULL, | ||
| 1446 | 0x00000000FDFDFDFDULL, | ||
| 1447 | 0x000000FDFDFDFDFDULL, | ||
| 1448 | 0x0000FDFDFDFDFDFDULL, | ||
| 1449 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1450 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1451 | }, | ||
| 1452 | { | ||
| 1453 | 0x000000000000FDFDULL, | ||
| 1454 | 0x0000000000FDFDFDULL, | ||
| 1455 | 0x00000000FDFDFDFDULL, | ||
| 1456 | 0x000000FDFDFDFDFDULL, | ||
| 1457 | 0x0000FDFDFDFDFDFDULL, | ||
| 1458 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1459 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1460 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1461 | }, | ||
| 1462 | { | ||
| 1463 | 0x0000000000FDFDFDULL, | ||
| 1464 | 0x00000000FDFDFDFDULL, | ||
| 1465 | 0x000000FDFDFDFDFDULL, | ||
| 1466 | 0x0000FDFDFDFDFDFDULL, | ||
| 1467 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1468 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1469 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1470 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1471 | }, | ||
| 1472 | { | ||
| 1473 | 0x00000000FDFDFDFDULL, | ||
| 1474 | 0x000000FDFDFDFDFDULL, | ||
| 1475 | 0x0000FDFDFDFDFDFDULL, | ||
| 1476 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1477 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1478 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1479 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1480 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1481 | }, | ||
| 1482 | { | ||
| 1483 | 0x000000FDFDFDFDFDULL, | ||
| 1484 | 0x0000FDFDFDFDFDFDULL, | ||
| 1485 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1486 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1487 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1488 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1489 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1490 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1491 | }, | ||
| 1492 | { | ||
| 1493 | 0x0000FDFDFDFDFDFDULL, | ||
| 1494 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1495 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1496 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1497 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1498 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1499 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1500 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1501 | }, | ||
| 1502 | { | ||
| 1503 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1504 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1505 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1506 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1507 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1508 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1509 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1510 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1511 | }, | ||
| 1512 | { | ||
| 1513 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1514 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1515 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1516 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1517 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1518 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1519 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1520 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1521 | } | ||
| 1522 | } | ||
| 1523 | }; | ||
| 1524 | |||
| 1525 | int32_t black_opening_count=0; | ||
| 1526 | int32_t black_opening_x,black_opening_y; | ||
| 1527 | int32_t black_opening_shape; | ||
| 1528 | |||
| 1529 | 3231 | int32_t choose_opening_shape() | |
| 1530 | { | ||
| 1531 | // First, count how many bits are set | ||
| 1532 | 3231 | int32_t numBits=0; | |
| 1533 | int32_t bitCounter; | ||
| 1534 | |||
| 1535 |
2/2✓ Branch 0 taken 16155 times.
✓ Branch 1 taken 3231 times.
|
19386 | for(int32_t i=0; i<bosMAX; i++) |
| 1536 | { | ||
| 1537 |
2/2✓ Branch 0 taken 12708 times.
✓ Branch 1 taken 3447 times.
|
16155 | if(COOLSCROLL&(1<<i)) |
| 1538 | 3447 | numBits++; | |
| 1539 | 16155 | } | |
| 1540 | |||
| 1541 | // Shouldn't happen... | ||
| 1542 |
1/2✓ Branch 0 taken 3231 times.
✗ Branch 1 not taken.
|
3231 | if(numBits==0) |
| 1543 | ✗ | return bosCIRCLE; | |
| 1544 | |||
| 1545 | // Pick a bit | ||
| 1546 | 3231 | bitCounter=zc_rand()%numBits+1; | |
| 1547 | |||
| 1548 |
2/2✓ Branch 0 taken 4422 times.
✓ Branch 1 taken 26 times.
|
4448 | for(int32_t i=0; i<bosMAX; i++) |
| 1549 | { | ||
| 1550 | // If this bit is set, decrement the bit counter | ||
| 1551 |
2/2✓ Branch 0 taken 1061 times.
✓ Branch 1 taken 3361 times.
|
4422 | if(COOLSCROLL&(1<<i)) |
| 1552 | 3361 | bitCounter--; | |
| 1553 | |||
| 1554 | // When the counter hits 0, return a value based on | ||
| 1555 | // which bit it stopped on. | ||
| 1556 | // Reminder: enum {bosCIRCLE=0, bosOVAL, bosTRIANGLE, bosSMAS, bosFADEBLACK, bosMAX}; | ||
| 1557 |
2/2✓ Branch 0 taken 3205 times.
✓ Branch 1 taken 1217 times.
|
4422 | if(bitCounter==0) |
| 1558 | 3205 | return i; | |
| 1559 | 1217 | } | |
| 1560 | |||
| 1561 | // Shouldn't be necessary, but the compiler might complain, at least | ||
| 1562 | 26 | return bosCIRCLE; | |
| 1563 | 3231 | } | |
| 1564 | |||
| 1565 | 727 | void close_black_opening(int32_t x, int32_t y, bool wait, int32_t shape) | |
| 1566 | { | ||
| 1567 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 727 times.
|
727 | black_opening_shape= (shape>-1 ? shape : choose_opening_shape()); |
| 1568 | |||
| 1569 | 727 | int32_t w=256, h=224; | |
| 1570 | 727 | int32_t blockrows=28, blockcolumns=32; | |
| 1571 | 727 | int32_t xoffset=(x-(w/2))/8, yoffset=(y-(h/2))/8; | |
| 1572 | |||
| 1573 |
2/2✓ Branch 0 taken 20356 times.
✓ Branch 1 taken 727 times.
|
21083 | for(int32_t blockrow=0; blockrow<blockrows; ++blockrow) //30 |
| 1574 | { | ||
| 1575 |
2/2✓ Branch 0 taken 651392 times.
✓ Branch 1 taken 20356 times.
|
671748 | for(int32_t blockcolumn=0; blockcolumn<blockcolumns; ++blockcolumn) //40 |
| 1576 | { | ||
| 1577 |
2/2✓ Branch 0 taken 269309 times.
✓ Branch 1 taken 382083 times.
|
651392 | screen_triangles[blockrow][blockcolumn]=zc_max(abs(int32_t(double(blockcolumns-1)/2-blockcolumn+xoffset)),abs(int32_t(double(blockrows-1)/2-blockrow+yoffset)))|0x0100|((blockrow-yoffset<blockrows/2)?0:0x8000)|((blockcolumn-xoffset<blockcolumns/2)?0x4000:0); |
| 1578 | 651392 | } | |
| 1579 | 20356 | } | |
| 1580 | |||
| 1581 | 727 | black_opening_count = 66; | |
| 1582 | 727 | black_opening_x = x; | |
| 1583 | 727 | black_opening_y = y; | |
| 1584 | 727 | lensclk = 0; | |
| 1585 | //black_opening_shape=(black_opening_shape+1)%bosMAX; | ||
| 1586 | |||
| 1587 | |||
| 1588 |
1/2✓ Branch 0 taken 727 times.
✗ Branch 1 not taken.
|
727 | if(black_opening_shape == bosFADEBLACK) |
| 1589 | { | ||
| 1590 | ✗ | refreshTints(); | |
| 1591 | ✗ | memcpy(tempblackpal, RAMpal, sizeof(RAMpal)); //Store palette in temp palette for fade effect | |
| 1592 | ✗ | } | |
| 1593 |
2/2✓ Branch 0 taken 723 times.
✓ Branch 1 taken 4 times.
|
727 | if(wait) |
| 1594 | { | ||
| 1595 | 4 | FFCore.warpScriptCheck(); | |
| 1596 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 264 times.
|
268 | for(int32_t i=0; i<66; i++) |
| 1597 | { | ||
| 1598 | 264 | draw_screen(tmpscr); | |
| 1599 | //put_passive_subscr(framebuf,0,passive_subscreen_offset,false,sspUP); | ||
| 1600 | 264 | advanceframe(true); | |
| 1601 | |||
| 1602 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 264 times.
|
264 | if(Quit) |
| 1603 | { | ||
| 1604 | ✗ | break; | |
| 1605 | } | ||
| 1606 | 264 | } | |
| 1607 | 4 | } | |
| 1608 | 727 | } | |
| 1609 | |||
| 1610 | 2504 | void open_black_opening(int32_t x, int32_t y, bool wait, int32_t shape) | |
| 1611 | { | ||
| 1612 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2504 times.
|
2504 | black_opening_shape= (shape>-1 ? shape : choose_opening_shape()); |
| 1613 | |||
| 1614 | 2504 | int32_t w=256, h=224; | |
| 1615 | 2504 | int32_t blockrows=28, blockcolumns=32; | |
| 1616 | 2504 | int32_t xoffset=(x-(w/2))/8, yoffset=(y-(h/2))/8; | |
| 1617 | |||
| 1618 |
2/2✓ Branch 0 taken 70112 times.
✓ Branch 1 taken 2504 times.
|
72616 | for(int32_t blockrow=0; blockrow<blockrows; ++blockrow) //30 |
| 1619 | { | ||
| 1620 |
2/2✓ Branch 0 taken 2243584 times.
✓ Branch 1 taken 70112 times.
|
2313696 | for(int32_t blockcolumn=0; blockcolumn<blockcolumns; ++blockcolumn) //40 |
| 1621 | { | ||
| 1622 |
2/2✓ Branch 0 taken 1105155 times.
✓ Branch 1 taken 1138429 times.
|
2243584 | screen_triangles[blockrow][blockcolumn]=zc_max(abs(int32_t(double(blockcolumns-1)/2-blockcolumn+xoffset)),abs(int32_t(double(blockrows-1)/2-blockrow+yoffset)))|0x0100|((blockrow-yoffset<blockrows/2)?0:0x8000)|((blockcolumn-xoffset<blockcolumns/2)?0x4000:0); |
| 1623 | 2243584 | } | |
| 1624 | 70112 | } | |
| 1625 | |||
| 1626 | 2504 | black_opening_count = -66; | |
| 1627 | 2504 | black_opening_x = x; | |
| 1628 | 2504 | black_opening_y = y; | |
| 1629 | 2504 | lensclk = 0; | |
| 1630 |
1/2✓ Branch 0 taken 2504 times.
✗ Branch 1 not taken.
|
2504 | if(black_opening_shape == bosFADEBLACK) |
| 1631 | { | ||
| 1632 | ✗ | refreshTints(); | |
| 1633 | ✗ | memcpy(tempblackpal, RAMpal, sizeof(RAMpal)); //Store palette in temp palette for fade effect | |
| 1634 | ✗ | } | |
| 1635 |
2/2✓ Branch 0 taken 369 times.
✓ Branch 1 taken 2135 times.
|
2504 | if(wait) |
| 1636 | { | ||
| 1637 | 2135 | FFCore.warpScriptCheck(); | |
| 1638 |
2/2✓ Branch 0 taken 2134 times.
✓ Branch 1 taken 140913 times.
|
143047 | for(int32_t i=0; i<66; i++) |
| 1639 | { | ||
| 1640 | 140913 | draw_screen(tmpscr); | |
| 1641 | //put_passive_subscr(framebuf,0,passive_subscreen_offset,false,sspUP); | ||
| 1642 | 140913 | advanceframe(true); | |
| 1643 | |||
| 1644 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 140912 times.
|
140913 | if(Quit) |
| 1645 | { | ||
| 1646 | 1 | break; | |
| 1647 | } | ||
| 1648 | 140912 | } | |
| 1649 | 2135 | } | |
| 1650 | 2504 | } | |
| 1651 | |||
| 1652 | 212405 | void black_opening(BITMAP *dest,int32_t x,int32_t y,int32_t a,int32_t max_a) | |
| 1653 | { | ||
| 1654 | 212405 | clear_to_color(tmp_scr,BLACK); | |
| 1655 | 212405 | int32_t w=256, h=224; | |
| 1656 | |||
| 1657 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 9636 times.
✓ Branch 2 taken 660 times.
✓ Branch 3 taken 20262 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 181847 times.
|
212405 | switch(black_opening_shape) |
| 1658 | { | ||
| 1659 | case bosOVAL: | ||
| 1660 | { | ||
| 1661 | 9636 | double new_w=(w/2)+abs(w/2-x); | |
| 1662 | 9636 | double new_h=(h/2)+abs(h/2-y); | |
| 1663 | 9636 | double b=sqrt(((new_w*new_w)/4)+(new_h*new_h)); | |
| 1664 | 9636 | ellipsefill(tmp_scr,x,y,int32_t(2*a*b/max_a)/8*8,int32_t(a*b/max_a)/8*8,0); | |
| 1665 | 9636 | break; | |
| 1666 | } | ||
| 1667 | |||
| 1668 | case bosTRIANGLE: | ||
| 1669 | { | ||
| 1670 | 660 | double new_w=(w/2)+abs(w/2-x); | |
| 1671 | 660 | double new_h=(h/2)+abs(h/2-y); | |
| 1672 | 660 | double r=a*(new_w*sqrt((double)3)+new_h)/max_a; | |
| 1673 | 660 | double P2= (PI/2); | |
| 1674 | 660 | double P23=(2*PI/3); | |
| 1675 | 660 | double P43=(4*PI/3); | |
| 1676 | 660 | double Pa= (-4*PI*a/(3*max_a)); | |
| 1677 | 660 | double angle=P2+Pa; | |
| 1678 | 660 | double a0=angle; | |
| 1679 | 660 | double a2=angle+P23; | |
| 1680 | 660 | double a4=angle+P43; | |
| 1681 | 1320 | triangle(tmp_scr, x+int32_t(zc::math::Cos(a0)*r), y-int32_t(zc::math::Sin(a0)*r), | |
| 1682 | 660 | x+int32_t(zc::math::Cos(a2)*r), y-int32_t(zc::math::Sin(a2)*r), | |
| 1683 | 660 | x+int32_t(zc::math::Cos(a4)*r), y-int32_t(zc::math::Sin(a4)*r), | |
| 1684 | 0); | ||
| 1685 | 660 | break; | |
| 1686 | } | ||
| 1687 | |||
| 1688 | case bosSMAS: | ||
| 1689 | { | ||
| 1690 |
2/2✓ Branch 0 taken 7194 times.
✓ Branch 1 taken 13068 times.
|
20262 | int32_t distance=zc_max(abs(w/2-x),abs(h/2-y))/8; |
| 1691 | |||
| 1692 |
2/2✓ Branch 0 taken 567336 times.
✓ Branch 1 taken 20262 times.
|
587598 | for(int32_t blockrow=0; blockrow<28; ++blockrow) //30 |
| 1693 | { | ||
| 1694 |
2/2✓ Branch 0 taken 4538688 times.
✓ Branch 1 taken 567336 times.
|
5106024 | for(int32_t linerow=0; linerow<8; ++linerow) |
| 1695 | { | ||
| 1696 | 4538688 | qword *triangleline=(qword*)(tmp_scr->line[(blockrow*8+linerow)]); | |
| 1697 | |||
| 1698 |
2/2✓ Branch 0 taken 145238016 times.
✓ Branch 1 taken 4538688 times.
|
149776704 | for(int32_t blockcolumn=0; blockcolumn<32; ++blockcolumn) //40 |
| 1699 | { | ||
| 1700 | 435714048 | *triangleline=triangles[(screen_triangles[blockrow][blockcolumn]&0xC000)>>14] | |
| 1701 |
6/6✓ Branch 0 taken 104912184 times.
✓ Branch 1 taken 40325832 times.
✓ Branch 2 taken 95821040 times.
✓ Branch 3 taken 49416976 times.
✓ Branch 4 taken 55495208 times.
✓ Branch 5 taken 40325832 times.
|
145238016 | [zc_min(zc_max((((31+distance)*(max_a-a)/max_a)+((screen_triangles[blockrow][blockcolumn]&0x0FFF)-0x0100)-(15+distance)),0),15)] |
| 1702 | 145238016 | [linerow]; | |
| 1703 | 145238016 | ++triangleline; | |
| 1704 | |||
| 1705 |
2/2✓ Branch 0 taken 127083264 times.
✓ Branch 1 taken 18154752 times.
|
145238016 | if(linerow==0) |
| 1706 | { | ||
| 1707 | 18154752 | } | |
| 1708 | 145238016 | } | |
| 1709 | 4538688 | } | |
| 1710 | 567336 | } | |
| 1711 | |||
| 1712 | 20262 | break; | |
| 1713 | } | ||
| 1714 | |||
| 1715 | case bosFADEBLACK: | ||
| 1716 | { | ||
| 1717 | ✗ | if(black_opening_count<0) | |
| 1718 | { | ||
| 1719 | ✗ | black_fade(zc_min(-black_opening_count,63)); | |
| 1720 | ✗ | } | |
| 1721 | ✗ | else if(black_opening_count>0) | |
| 1722 | { | ||
| 1723 | ✗ | black_fade(63-zc_max(black_opening_count-3,0)); | |
| 1724 | ✗ | } | |
| 1725 | ✗ | else black_fade(0); | |
| 1726 | ✗ | return; //no blitting from tmp_scr! | |
| 1727 | } | ||
| 1728 | |||
| 1729 | 181847 | case bosCIRCLE: | |
| 1730 | default: | ||
| 1731 | { | ||
| 1732 | 181847 | double new_w=(w/2)+abs(w/2-x); | |
| 1733 | 181847 | double new_h=(h/2)+abs(h/2-y); | |
| 1734 | 181847 | int32_t r=int32_t(sqrt((new_w*new_w)+(new_h*new_h))*a/max_a); | |
| 1735 | //circlefill(tmp_scr,x,y,a<<3,0); | ||
| 1736 | 181847 | circlefill(tmp_scr,x,y,r,0); | |
| 1737 | 181847 | break; | |
| 1738 | } | ||
| 1739 | } | ||
| 1740 | |||
| 1741 | 212405 | masked_blit(tmp_scr,dest,0,0,0,0,320,240); | |
| 1742 | 212405 | } | |
| 1743 | |||
| 1744 | // fadeamnt is 0-63 | ||
| 1745 | ✗ | void black_fade(int32_t fadeamnt) | |
| 1746 | { | ||
| 1747 | ✗ | fadeamnt = _rgb_scale_6[fadeamnt]; | |
| 1748 | ✗ | for(int32_t i=0; i < 0xEF; i++) | |
| 1749 | { | ||
| 1750 | ✗ | RAMpal[i].r = vbound(tempblackpal[i].r-fadeamnt,0,255); | |
| 1751 | ✗ | RAMpal[i].g = vbound(tempblackpal[i].g-fadeamnt,0,255); | |
| 1752 | ✗ | RAMpal[i].b = vbound(tempblackpal[i].b-fadeamnt,0,255); | |
| 1753 | ✗ | } | |
| 1754 | |||
| 1755 | ✗ | refreshpal = true; | |
| 1756 | ✗ | } | |
| 1757 | |||
| 1758 | //---------------------------------------------------------------- | ||
| 1759 | |||
| 1760 | 198417219 | bool item_disabled(int32_t item) //is this item disabled? | |
| 1761 | { | ||
| 1762 |
2/2✓ Branch 0 taken 14363454 times.
✓ Branch 1 taken 184053765 times.
|
198417219 | return (unsigned(item) < MAXITEMS && game->items_off[item] != 0); |
| 1763 | } | ||
| 1764 | |||
| 1765 | 15459053 | bool can_use_item(int32_t item_type, int32_t item) //can Hero use this item? | |
| 1766 | { | ||
| 1767 |
2/2✓ Branch 0 taken 188072 times.
✓ Branch 1 taken 15270981 times.
|
15459053 | if(current_item(item_type, true) >=item) |
| 1768 | { | ||
| 1769 | 188072 | return true; | |
| 1770 | } | ||
| 1771 | |||
| 1772 | 15270981 | return false; | |
| 1773 | 15459053 | } | |
| 1774 | |||
| 1775 | 48077764 | bool has_item(int32_t item_type, int32_t it) //does Hero possess this item? | |
| 1776 | { | ||
| 1777 |
5/9✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 4372117 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4902235 times.
✓ Branch 6 taken 28714956 times.
✓ Branch 7 taken 9894002 times.
✓ Branch 8 taken 194454 times.
|
48077764 | switch(item_type) |
| 1778 | { | ||
| 1779 | case itype_bomb: | ||
| 1780 | case itype_sbomb: | ||
| 1781 | { | ||
| 1782 | ✗ | int32_t itemid = getItemID(itemsbuf, item_type, it); | |
| 1783 | |||
| 1784 | ✗ | if(itemid == -1) | |
| 1785 | ✗ | return false; | |
| 1786 | |||
| 1787 | ✗ | return (game->get_item(itemid)); | |
| 1788 | } | ||
| 1789 | |||
| 1790 | case itype_clock: | ||
| 1791 | { | ||
| 1792 | 4372117 | int32_t itemid = getItemID(itemsbuf, item_type, it); | |
| 1793 | |||
| 1794 |
2/4✓ Branch 0 taken 4372117 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4372117 times.
✗ Branch 3 not taken.
|
4372117 | if(itemid != -1 && (itemsbuf[itemid].flags & item_flag1)) //Active clock |
| 1795 | ✗ | return (game->get_item(itemid)); | |
| 1796 | 4372117 | return Hero.getClock()?1:0; | |
| 1797 | } | ||
| 1798 | |||
| 1799 | case itype_key: | ||
| 1800 | ✗ | return (game->get_keys()>0); | |
| 1801 | |||
| 1802 | case itype_magiccontainer: | ||
| 1803 | ✗ | return (game->get_maxmagic()>=game->get_mp_per_block()); | |
| 1804 | |||
| 1805 | case itype_triforcepiece: //it: -2=any, -1=current level, other=that level | ||
| 1806 | { | ||
| 1807 |
2/3✓ Branch 0 taken 321216 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4581019 times.
|
4902235 | switch(it) |
| 1808 | { | ||
| 1809 | case -2: | ||
| 1810 | { | ||
| 1811 | ✗ | for(int32_t i=0; i<MAXLEVELS; i++) | |
| 1812 | { | ||
| 1813 | ✗ | if(game->lvlitems[i]&liTRIFORCE) | |
| 1814 | { | ||
| 1815 | ✗ | return true; | |
| 1816 | } | ||
| 1817 | ✗ | } | |
| 1818 | |||
| 1819 | ✗ | return false; | |
| 1820 | } | ||
| 1821 | |||
| 1822 | case -1: | ||
| 1823 | 4581019 | return (game->lvlitems[dlevel]&liTRIFORCE); | |
| 1824 | |||
| 1825 | default: | ||
| 1826 |
2/4✓ Branch 0 taken 321216 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 321216 times.
|
321216 | if(it>=0&&it<MAXLEVELS) |
| 1827 | { | ||
| 1828 | 321216 | return (game->lvlitems[it]&liTRIFORCE); | |
| 1829 | } | ||
| 1830 | |||
| 1831 | ✗ | break; | |
| 1832 | } | ||
| 1833 | |||
| 1834 | ✗ | return 0; | |
| 1835 | } | ||
| 1836 | |||
| 1837 | case itype_map: //it: -2=any, -1=current level, other=that level | ||
| 1838 | { | ||
| 1839 |
2/3✓ Branch 0 taken 540402 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 28174554 times.
|
28714956 | switch(it) |
| 1840 | { | ||
| 1841 | case -2: | ||
| 1842 | { | ||
| 1843 | ✗ | for(int32_t i=0; i<MAXLEVELS; i++) | |
| 1844 | { | ||
| 1845 | ✗ | if(game->lvlitems[i]&liMAP) | |
| 1846 | { | ||
| 1847 | ✗ | return true; | |
| 1848 | } | ||
| 1849 | ✗ | } | |
| 1850 | |||
| 1851 | ✗ | return false; | |
| 1852 | } | ||
| 1853 | |||
| 1854 | case -1: | ||
| 1855 | 28174554 | return (game->lvlitems[dlevel]&liMAP)!=0; | |
| 1856 | |||
| 1857 | default: | ||
| 1858 |
2/4✓ Branch 0 taken 540402 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 540402 times.
|
540402 | if(it>=0&&it<MAXLEVELS) |
| 1859 | { | ||
| 1860 | 540402 | return (game->lvlitems[it]&liMAP)!=0; | |
| 1861 | } | ||
| 1862 | |||
| 1863 | ✗ | break; | |
| 1864 | } | ||
| 1865 | |||
| 1866 | ✗ | return 0; | |
| 1867 | } | ||
| 1868 | |||
| 1869 | case itype_compass: //it: -2=any, -1=current level, other=that level | ||
| 1870 | { | ||
| 1871 |
1/3✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 9894002 times.
|
9894002 | switch(it) |
| 1872 | { | ||
| 1873 | case -2: | ||
| 1874 | { | ||
| 1875 | ✗ | for(int32_t i=0; i<MAXLEVELS; i++) | |
| 1876 | { | ||
| 1877 | ✗ | if(game->lvlitems[i]&liCOMPASS) | |
| 1878 | { | ||
| 1879 | ✗ | return true; | |
| 1880 | } | ||
| 1881 | ✗ | } | |
| 1882 | |||
| 1883 | ✗ | return false; | |
| 1884 | } | ||
| 1885 | |||
| 1886 | case -1: | ||
| 1887 | 9894002 | return (game->lvlitems[dlevel]&liCOMPASS)!=0; | |
| 1888 | |||
| 1889 | default: | ||
| 1890 | ✗ | if(it>=0&&it<MAXLEVELS) | |
| 1891 | { | ||
| 1892 | ✗ | return (game->lvlitems[it]&liCOMPASS)!=0; | |
| 1893 | } | ||
| 1894 | |||
| 1895 | ✗ | break; | |
| 1896 | } | ||
| 1897 | ✗ | return 0; | |
| 1898 | } | ||
| 1899 | |||
| 1900 | case itype_bosskey: //it: -2=any, -1=current level, other=that level | ||
| 1901 | { | ||
| 1902 |
1/3✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 194454 times.
|
194454 | switch(it) |
| 1903 | { | ||
| 1904 | case -2: | ||
| 1905 | { | ||
| 1906 | ✗ | for(int32_t i=0; i<MAXLEVELS; i++) | |
| 1907 | { | ||
| 1908 | ✗ | if(game->lvlitems[i]&liBOSSKEY) | |
| 1909 | { | ||
| 1910 | ✗ | return true; | |
| 1911 | } | ||
| 1912 | ✗ | } | |
| 1913 | |||
| 1914 | ✗ | return false; | |
| 1915 | } | ||
| 1916 | |||
| 1917 | case -1: | ||
| 1918 | 194454 | return (game->lvlitems[dlevel]&liBOSSKEY)?1:0; | |
| 1919 | |||
| 1920 | default: | ||
| 1921 | ✗ | if(it>=0&&it<MAXLEVELS) | |
| 1922 | { | ||
| 1923 | ✗ | return (game->lvlitems[it]&liBOSSKEY)?1:0; | |
| 1924 | } | ||
| 1925 | ✗ | break; | |
| 1926 | } | ||
| 1927 | ✗ | return 0; | |
| 1928 | } | ||
| 1929 | |||
| 1930 | default: | ||
| 1931 | ✗ | int32_t itemid = getItemID(itemsbuf, item_type, it); | |
| 1932 | |||
| 1933 | ✗ | if(itemid == -1) | |
| 1934 | ✗ | return false; | |
| 1935 | |||
| 1936 | ✗ | return game->get_item(itemid); | |
| 1937 | } | ||
| 1938 | 48077764 | } | |
| 1939 | |||
| 1940 | 149261736 | int current_item(int item_type, bool checkmagic, bool jinx_check, bool check_bunny) | |
| 1941 | { | ||
| 1942 |
9/9✓ Branch 0 taken 4372117 times.
✓ Branch 1 taken 114284800 times.
✓ Branch 2 taken 4372117 times.
✓ Branch 3 taken 4372117 times.
✓ Branch 4 taken 4372117 times.
✓ Branch 5 taken 4372117 times.
✓ Branch 6 taken 4372117 times.
✓ Branch 7 taken 4372117 times.
✓ Branch 8 taken 4372117 times.
|
149261736 | switch(item_type) |
| 1943 | { | ||
| 1944 | case itype_clock: | ||
| 1945 | { | ||
| 1946 | 4372117 | int maxid = current_item_id(item_type, checkmagic, jinx_check, check_bunny); | |
| 1947 | |||
| 1948 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 4372117 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
4372117 | if(maxid != -1 && (itemsbuf[maxid].flags & item_flag1)) //Active clock |
| 1949 | ✗ | return itemsbuf[maxid].fam_type; | |
| 1950 | |||
| 1951 | 4372117 | return has_item(itype_clock,1) ? 1 : 0; | |
| 1952 | } | ||
| 1953 | |||
| 1954 | case itype_key: | ||
| 1955 | 4372117 | return game->get_keys(); | |
| 1956 | |||
| 1957 | case itype_lkey: | ||
| 1958 | 4372117 | return game->lvlkeys[get_dlevel()]; | |
| 1959 | |||
| 1960 | case itype_magiccontainer: | ||
| 1961 | 4372117 | return game->get_maxmagic()/game->get_mp_per_block(); | |
| 1962 | |||
| 1963 | case itype_triforcepiece: | ||
| 1964 | { | ||
| 1965 | 4372117 | int count=0; | |
| 1966 | |||
| 1967 |
2/2✓ Branch 0 taken 2238523904 times.
✓ Branch 1 taken 4372117 times.
|
2242896021 | for(int i=0; i<MAXLEVELS; i++) |
| 1968 | { | ||
| 1969 | 2238523904 | count+=(game->lvlitems[i]&liTRIFORCE)?1:0; | |
| 1970 | 2238523904 | } | |
| 1971 | |||
| 1972 | 4372117 | return count; | |
| 1973 | } | ||
| 1974 | |||
| 1975 | case itype_map: | ||
| 1976 | { | ||
| 1977 | 4372117 | int count=0; | |
| 1978 | |||
| 1979 |
2/2✓ Branch 0 taken 2238523904 times.
✓ Branch 1 taken 4372117 times.
|
2242896021 | for(int i=0; i<MAXLEVELS; i++) |
| 1980 | { | ||
| 1981 | 2238523904 | count+=(game->lvlitems[i]&liMAP)?1:0; | |
| 1982 | 2238523904 | } | |
| 1983 | |||
| 1984 | 4372117 | return count; | |
| 1985 | } | ||
| 1986 | |||
| 1987 | case itype_compass: | ||
| 1988 | { | ||
| 1989 | 4372117 | int count=0; | |
| 1990 | |||
| 1991 |
2/2✓ Branch 0 taken 2238523904 times.
✓ Branch 1 taken 4372117 times.
|
2242896021 | for(int i=0; i<MAXLEVELS; i++) |
| 1992 | { | ||
| 1993 | 2238523904 | count+=(game->lvlitems[i]&liCOMPASS)?1:0; | |
| 1994 | 2238523904 | } | |
| 1995 | |||
| 1996 | 4372117 | return count; | |
| 1997 | } | ||
| 1998 | |||
| 1999 | case itype_bosskey: | ||
| 2000 | { | ||
| 2001 | 4372117 | int count=0; | |
| 2002 | |||
| 2003 |
2/2✓ Branch 0 taken 2238523904 times.
✓ Branch 1 taken 4372117 times.
|
2242896021 | for(int i=0; i<MAXLEVELS; i++) |
| 2004 | { | ||
| 2005 | 2238523904 | count+=(game->lvlitems[i]&liBOSSKEY)?1:0; | |
| 2006 | 2238523904 | } | |
| 2007 | |||
| 2008 | 4372117 | return count; | |
| 2009 | } | ||
| 2010 | |||
| 2011 | default: | ||
| 2012 | 114284800 | int maxid = current_item_id(item_type, checkmagic, jinx_check, check_bunny); | |
| 2013 | |||
| 2014 |
2/2✓ Branch 0 taken 81258973 times.
✓ Branch 1 taken 33025827 times.
|
114284800 | if(maxid == -1) |
| 2015 | 81258973 | return 0; | |
| 2016 | |||
| 2017 | 33025827 | return itemsbuf[maxid].fam_type; | |
| 2018 | } | ||
| 2019 | 149261736 | } | |
| 2020 | |||
| 2021 | 356 | std::map<int32_t, int32_t> itemcache; | |
| 2022 | 356 | std::map<int32_t, int32_t> itemcache_cost; | |
| 2023 | |||
| 2024 | ✗ | void removeFromItemCache(int32_t itemclass) | |
| 2025 | { | ||
| 2026 | ✗ | itemcache.erase(itemclass); | |
| 2027 | ✗ | itemcache_cost.erase(itemclass); | |
| 2028 | ✗ | cache_tile_mod_clear(); | |
| 2029 | ✗ | } | |
| 2030 | |||
| 2031 | 12390121 | void flushItemCache(bool justcost) | |
| 2032 | { | ||
| 2033 | 12390121 | itemcache_cost.clear(); | |
| 2034 |
2/2✓ Branch 0 taken 12323670 times.
✓ Branch 1 taken 66451 times.
|
12390121 | if(!justcost) |
| 2035 | 66451 | itemcache.clear(); | |
| 2036 |
2/2✓ Branch 0 taken 5826470 times.
✓ Branch 1 taken 6497200 times.
|
12323670 | else if(replay_version_check(0,19)) |
| 2037 | 5826470 | return; | |
| 2038 | |||
| 2039 | 6563651 | cache_tile_mod_clear(); | |
| 2040 | |||
| 2041 | //also fix the active subscreen if items were deleted -DD | ||
| 2042 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6563651 times.
|
6563651 | if(game != NULL) |
| 2043 | { | ||
| 2044 | 6563651 | verifyBothWeapons(); | |
| 2045 | 6563651 | refresh_subscr_items(); | |
| 2046 | 6563651 | } | |
| 2047 | 12390121 | } | |
| 2048 | |||
| 2049 | // This is used often, so it should be as direct as possible. | ||
| 2050 | 2947328713 | int _c_item_id_internal(int itemtype, bool checkmagic, bool jinx_check, bool check_bunny) | |
| 2051 | { | ||
| 2052 | 2947328713 | bool use_cost_cache = replay_version_check(19); | |
| 2053 |
2/2✓ Branch 0 taken 2823038478 times.
✓ Branch 1 taken 124290235 times.
|
2947328713 | if(jinx_check) |
| 2054 | { | ||
| 2055 | //special case for shields... | ||
| 2056 |
3/4✓ Branch 0 taken 39650862 times.
✓ Branch 1 taken 84639373 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 39650862 times.
|
124290235 | if (itemtype == itype_shield && !HeroShieldClk()) |
| 2057 | 39650862 | jinx_check = false; | |
| 2058 |
4/4✓ Branch 0 taken 52100529 times.
✓ Branch 1 taken 32538844 times.
✓ Branch 2 taken 10855064 times.
✓ Branch 3 taken 41245465 times.
|
84639373 | else if(!(HeroSwordClk() || HeroItemClk())) |
| 2059 | 41245465 | jinx_check = false; //not jinxed | |
| 2060 | 124290235 | } | |
| 2061 |
4/4✓ Branch 0 taken 103098 times.
✓ Branch 1 taken 2947225615 times.
✓ Branch 2 taken 1853 times.
✓ Branch 3 taken 101245 times.
|
2947328713 | if(!Hero.BunnyClock() || itemtype == itype_pearl) // bunny_check does not apply |
| 2062 | 2947227468 | check_bunny = false; | |
| 2063 |
2/2✓ Branch 0 taken 2891418911 times.
✓ Branch 1 taken 55909802 times.
|
2947328713 | if(itemtype == itype_ring) checkmagic = true; |
| 2064 |
4/4✓ Branch 0 taken 2903934805 times.
✓ Branch 1 taken 43393908 times.
✓ Branch 2 taken 274610759 times.
✓ Branch 3 taken 23761870 times.
|
3245701342 | if (!jinx_check && !check_bunny |
| 2065 |
4/4✓ Branch 0 taken 2903855558 times.
✓ Branch 1 taken 79247 times.
✓ Branch 2 taken 298372629 times.
✓ Branch 3 taken 2605482929 times.
|
2903934805 | && (use_cost_cache || itemtype != itype_ring)) |
| 2066 | { | ||
| 2067 |
4/4✓ Branch 0 taken 534001200 times.
✓ Branch 1 taken 2346092488 times.
✓ Branch 2 taken 232792503 times.
✓ Branch 3 taken 301208697 times.
|
2880093688 | auto& cache = checkmagic && use_cost_cache ? itemcache_cost : itemcache; |
| 2068 | 2880093688 | auto res = cache.find(itemtype); | |
| 2069 | |||
| 2070 |
2/2✓ Branch 0 taken 2736518961 times.
✓ Branch 1 taken 143574727 times.
|
2880093688 | if(res != cache.end()) |
| 2071 | 2736518961 | return res->second; | |
| 2072 | 143574727 | } | |
| 2073 | |||
| 2074 | 210809752 | int result = -1; | |
| 2075 | 210809752 | int highestlevel = -1; | |
| 2076 | |||
| 2077 |
2/2✓ Branch 0 taken 53967296512 times.
✓ Branch 1 taken 210809752 times.
|
54178106264 | for(int i=0; i<MAXITEMS; i++) |
| 2078 | { | ||
| 2079 |
6/6✓ Branch 0 taken 5919763468 times.
✓ Branch 1 taken 48047533044 times.
✓ Branch 2 taken 95478335 times.
✓ Branch 3 taken 5824285133 times.
✓ Branch 4 taken 82048 times.
✓ Branch 5 taken 95396287 times.
|
53967296512 | if(game->get_item(i) && itemsbuf[i].family==itemtype && !item_disabled(i)) |
| 2080 | { | ||
| 2081 |
4/4✓ Branch 0 taken 90784192 times.
✓ Branch 1 taken 4612095 times.
✓ Branch 2 taken 2425909 times.
✓ Branch 3 taken 88358283 times.
|
95396287 | if(checkmagic && itemtype != itype_magicring) |
| 2082 |
2/2✓ Branch 0 taken 88357666 times.
✓ Branch 1 taken 617 times.
|
88358283 | if(!checkmagiccost(i)) |
| 2083 | 617 | continue; | |
| 2084 |
6/6✓ Branch 0 taken 87821240 times.
✓ Branch 1 taken 7574430 times.
✓ Branch 2 taken 1253626 times.
✓ Branch 3 taken 6320804 times.
✓ Branch 4 taken 4128291 times.
✓ Branch 5 taken 3446139 times.
|
95395670 | if(jinx_check && (usesSwordJinx(i) ? HeroSwordClk() : HeroItemClk())) |
| 2085 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3446139 times.
|
3446139 | if(!(itemsbuf[i].flags & item_jinx_immune)) |
| 2086 | 3446139 | continue; | |
| 2087 |
3/4✓ Branch 0 taken 86055 times.
✓ Branch 1 taken 91863476 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 86055 times.
|
91949531 | if(check_bunny && !checkbunny(i)) |
| 2088 | 86055 | continue; | |
| 2089 | |||
| 2090 |
2/2✓ Branch 0 taken 8380447 times.
✓ Branch 1 taken 83483029 times.
|
91863476 | if(itemsbuf[i].fam_type >= highestlevel) |
| 2091 | { | ||
| 2092 | 83483029 | highestlevel = itemsbuf[i].fam_type; | |
| 2093 | 83483029 | result=i; | |
| 2094 | 83483029 | } | |
| 2095 | 91863476 | } | |
| 2096 | 53963763701 | } | |
| 2097 | |||
| 2098 |
4/4✓ Branch 0 taken 167415844 times.
✓ Branch 1 taken 43393908 times.
✓ Branch 2 taken 79247 times.
✓ Branch 3 taken 167336597 times.
|
210809752 | if(!(jinx_check || check_bunny)) //Can't cache jinx_check/check_bunny |
| 2099 | { | ||
| 2100 |
2/2✓ Branch 0 taken 127574818 times.
✓ Branch 1 taken 39761779 times.
|
167336597 | if (use_cost_cache) |
| 2101 | { | ||
| 2102 |
2/2✓ Branch 0 taken 111820054 times.
✓ Branch 1 taken 15754764 times.
|
127574818 | if (!checkmagic) |
| 2103 | 15754764 | itemcache[itemtype] = result; | |
| 2104 |
6/6✓ Branch 0 taken 15754764 times.
✓ Branch 1 taken 111820054 times.
✓ Branch 2 taken 659764 times.
✓ Branch 3 taken 15095000 times.
✓ Branch 4 taken 647135 times.
✓ Branch 5 taken 12629 times.
|
127574818 | if (checkmagic || result < 0 || checkmagiccost(result)) |
| 2105 | 127562189 | itemcache_cost[itemtype] = result; | |
| 2106 | 127574818 | } | |
| 2107 | else | ||
| 2108 | { | ||
| 2109 | 39761779 | itemcache[itemtype] = result; | |
| 2110 | } | ||
| 2111 | 167336597 | } | |
| 2112 | 210809752 | return result; | |
| 2113 | 2947328713 | } | |
| 2114 | |||
| 2115 | // 'jinx_check' indicates that the highest level item *immune to jinxes* should be returned. | ||
| 2116 | 2904434933 | int current_item_id(int itype, bool checkmagic, bool jinx_check, bool check_bunny) | |
| 2117 | { | ||
| 2118 |
2/4✓ Branch 0 taken 2904434933 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2904434933 times.
|
2904434933 | if(itype < 0 || itype >= itype_max) return -1; |
| 2119 |
1/2✓ Branch 0 taken 2904434933 times.
✗ Branch 1 not taken.
|
2904434933 | if(game->OverrideItems[itype] > -2) |
| 2120 | { | ||
| 2121 | ✗ | auto ovid = game->OverrideItems[itype]; | |
| 2122 | ✗ | if(ovid < 0 || ovid >= MAXITEMS) | |
| 2123 | ✗ | return -1; | |
| 2124 | ✗ | if(itemsbuf[ovid].family == itype) | |
| 2125 | { | ||
| 2126 | ✗ | if(itype == itype_magicring) | |
| 2127 | ✗ | checkmagic = false; | |
| 2128 | ✗ | else if(itype == itype_ring) | |
| 2129 | ✗ | checkmagic = true; | |
| 2130 | |||
| 2131 | ✗ | if(checkmagic && !checkmagiccost(ovid)) | |
| 2132 | ✗ | return -1; | |
| 2133 | |||
| 2134 | ✗ | if (jinx_check && !checkitem_jinx(ovid)) | |
| 2135 | { | ||
| 2136 | ✗ | return -1; | |
| 2137 | } | ||
| 2138 | ✗ | return ovid; | |
| 2139 | } | ||
| 2140 | ✗ | } | |
| 2141 | 2904434933 | auto ret = _c_item_id_internal(itype,checkmagic,jinx_check,check_bunny); | |
| 2142 |
2/2✓ Branch 0 taken 81396455 times.
✓ Branch 1 taken 2823038478 times.
|
2904434933 | if(!jinx_check) //If not already a jinx-immune-only check... |
| 2143 | { | ||
| 2144 | //And the player IS jinxed... | ||
| 2145 |
2/2✓ Branch 0 taken 2780144698 times.
✓ Branch 1 taken 42893780 times.
|
2823038478 | if(HeroIsJinxed()) |
| 2146 | { | ||
| 2147 | //Then do a jinx-immune-only check here | ||
| 2148 | 42893780 | auto ret2 = _c_item_id_internal(itype,checkmagic,true,check_bunny); | |
| 2149 | //And *IF IT FINDS A VALID ITEM*, return that one instead! -Em | ||
| 2150 | //Should NOT need a compat rule, as this should always return -1 in old quests. | ||
| 2151 |
2/2✓ Branch 0 taken 3252908 times.
✓ Branch 1 taken 39640872 times.
|
42893780 | if(ret2 > -1) return ret2; |
| 2152 | 39640872 | } | |
| 2153 | 2819785570 | } | |
| 2154 | 2901182025 | return ret; | |
| 2155 | 2904434933 | } | |
| 2156 | |||
| 2157 | 46384888 | int current_item_power(int itemtype, bool checkmagic, bool jinx_check, bool check_bunny) | |
| 2158 | { | ||
| 2159 | 46384888 | int result = current_item_id(itemtype, checkmagic, jinx_check, check_bunny); | |
| 2160 |
2/2✓ Branch 0 taken 26840494 times.
✓ Branch 1 taken 19544394 times.
|
46384888 | return (result<0) ? 0 : itemsbuf[result].power; |
| 2161 | } | ||
| 2162 | |||
| 2163 | 26 | int32_t heart_container_id() | |
| 2164 | { | ||
| 2165 |
1/2✓ Branch 0 taken 754 times.
✗ Branch 1 not taken.
|
754 | for(int32_t i=0; i<MAXITEMS; i++) |
| 2166 | { | ||
| 2167 |
2/2✓ Branch 0 taken 26 times.
✓ Branch 1 taken 728 times.
|
754 | if(itemsbuf[i].family == itype_heartcontainer) |
| 2168 | { | ||
| 2169 | 26 | return i; | |
| 2170 | } | ||
| 2171 | 728 | } | |
| 2172 | ✗ | return -1; | |
| 2173 | 26 | } | |
| 2174 | |||
| 2175 | struct tilemod_cache_state_t | ||
| 2176 | { | ||
| 2177 |
6/6✓ Branch 0 taken 4371762 times.
✓ Branch 1 taken 8413886 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 8413884 times.
✓ Branch 4 taken 353 times.
✓ Branch 5 taken 8413531 times.
|
21199534 | bool operator==(const tilemod_cache_state_t&) const = default; |
| 2178 | |||
| 2179 | bool valid; | ||
| 2180 | bool bunny_clock; | ||
| 2181 | bool superman; | ||
| 2182 | int shield; | ||
| 2183 | }; | ||
| 2184 | tilemod_cache_state_t tilemod_cache_state; | ||
| 2185 | int32_t tilemod_cache_value; | ||
| 2186 | |||
| 2187 | 6565091 | void cache_tile_mod_clear() | |
| 2188 | { | ||
| 2189 | 6565091 | tilemod_cache_state = {false}; | |
| 2190 | 6565091 | } | |
| 2191 | |||
| 2192 | 12785648 | int32_t item_tile_mod() | |
| 2193 | { | ||
| 2194 | 51142592 | tilemod_cache_state_t state = { | |
| 2195 | .valid = true, | ||
| 2196 | 12785648 | .bunny_clock = Hero.BunnyClock() != 0, | |
| 2197 | 12785648 | .superman = Hero.superman, | |
| 2198 | 12785648 | .shield = Hero.active_shield_id, | |
| 2199 | }; | ||
| 2200 |
2/2✓ Branch 0 taken 8413531 times.
✓ Branch 1 taken 4372117 times.
|
12785648 | if (tilemod_cache_state == state) |
| 2201 | 8413531 | return tilemod_cache_value; | |
| 2202 | |||
| 2203 | 4372117 | int32_t tile=0; | |
| 2204 | 4372117 | bool check_bombcost = !get_qr(qr_BROKEN_BOMB_AMMO_COSTS); | |
| 2205 |
4/4✓ Branch 0 taken 3958880 times.
✓ Branch 1 taken 413237 times.
✓ Branch 2 taken 3039601 times.
✓ Branch 3 taken 919279 times.
|
4372117 | if(check_bombcost || game->get_bombs()) |
| 2206 | { | ||
| 2207 | 3452838 | int32_t itemid = current_item_id(itype_bomb,check_bombcost); | |
| 2208 |
3/4✓ Branch 0 taken 3393365 times.
✓ Branch 1 taken 59473 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3393365 times.
|
3452838 | if(itemid > -1 && checkbunny(itemid)) |
| 2209 | 3393365 | tile+=itemsbuf[itemid].ltm; | |
| 2210 | 3452838 | } | |
| 2211 | |||
| 2212 |
4/4✓ Branch 0 taken 3958880 times.
✓ Branch 1 taken 413237 times.
✓ Branch 2 taken 928295 times.
✓ Branch 3 taken 3030585 times.
|
4372117 | if(check_bombcost || game->get_sbombs()) |
| 2213 | { | ||
| 2214 | 1341532 | int32_t itemid = current_item_id(itype_sbomb,check_bombcost); | |
| 2215 |
3/4✓ Branch 0 taken 928054 times.
✓ Branch 1 taken 413478 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 928054 times.
|
1341532 | if(itemid > -1 && checkbunny(itemid)) |
| 2216 | 928054 | tile+=itemsbuf[itemid].ltm; | |
| 2217 | 1341532 | } | |
| 2218 | |||
| 2219 |
2/2✓ Branch 0 taken 4367514 times.
✓ Branch 1 taken 4603 times.
|
4372117 | if(current_item(itype_clock)) |
| 2220 | { | ||
| 2221 | 4603 | int32_t itemid = | |
| 2222 |
2/2✓ Branch 0 taken 4594 times.
✓ Branch 1 taken 9 times.
|
4603 | get_qr(qr_HARDCODED_LITEM_LTMS) |
| 2223 | ? iClock | ||
| 2224 | 9 | : getHighestLevelEvenUnowned(itemsbuf, itype_clock); | |
| 2225 |
2/4✓ Branch 0 taken 4603 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4603 times.
|
4603 | if(itemid > -1 && checkbunny(itemid)) |
| 2226 | 4603 | tile+=itemsbuf[itemid].ltm; | |
| 2227 | 4603 | } | |
| 2228 | |||
| 2229 |
2/2✓ Branch 0 taken 3763476 times.
✓ Branch 1 taken 608641 times.
|
4372117 | if(current_item(itype_key)) |
| 2230 | { | ||
| 2231 | 608641 | int32_t itemid = | |
| 2232 |
1/2✓ Branch 0 taken 608641 times.
✗ Branch 1 not taken.
|
608641 | get_qr(qr_HARDCODED_LITEM_LTMS) |
| 2233 | ? iKey | ||
| 2234 | ✗ | : getHighestLevelEvenUnowned(itemsbuf, itype_key); | |
| 2235 |
2/4✓ Branch 0 taken 608641 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 608641 times.
|
608641 | if(itemid > -1 && checkbunny(itemid)) |
| 2236 | 608641 | tile+=itemsbuf[itemid].ltm; | |
| 2237 | 608641 | } | |
| 2238 | |||
| 2239 |
2/2✓ Branch 0 taken 3871257 times.
✓ Branch 1 taken 500860 times.
|
4372117 | if(current_item(itype_lkey)) |
| 2240 | { | ||
| 2241 | 500860 | int32_t itemid = | |
| 2242 |
2/2✓ Branch 0 taken 414146 times.
✓ Branch 1 taken 86714 times.
|
500860 | get_qr(qr_HARDCODED_LITEM_LTMS) |
| 2243 | ? iLevelKey | ||
| 2244 | 86714 | : getHighestLevelEvenUnowned(itemsbuf, itype_lkey); | |
| 2245 |
2/4✓ Branch 0 taken 500860 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 500860 times.
|
500860 | if(itemid > -1 && checkbunny(itemid)) |
| 2246 | 500860 | tile+=itemsbuf[itemid].ltm; | |
| 2247 | 500860 | } | |
| 2248 | |||
| 2249 |
2/2✓ Branch 0 taken 1537648 times.
✓ Branch 1 taken 2834469 times.
|
4372117 | if(current_item(itype_map)) |
| 2250 | { | ||
| 2251 | 2834469 | int32_t itemid = | |
| 2252 |
2/2✓ Branch 0 taken 2823835 times.
✓ Branch 1 taken 10634 times.
|
2834469 | get_qr(qr_HARDCODED_LITEM_LTMS) |
| 2253 | ? iMap | ||
| 2254 | 10634 | : getHighestLevelEvenUnowned(itemsbuf, itype_map); | |
| 2255 |
2/4✓ Branch 0 taken 2834469 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2834469 times.
|
2834469 | if(itemid > -1 && checkbunny(itemid)) |
| 2256 | 2834469 | tile+=itemsbuf[itemid].ltm; | |
| 2257 | 2834469 | } | |
| 2258 | |||
| 2259 |
2/2✓ Branch 0 taken 2060127 times.
✓ Branch 1 taken 2311990 times.
|
4372117 | if(current_item(itype_compass)) |
| 2260 | { | ||
| 2261 | 2311990 | int32_t itemid = | |
| 2262 |
2/2✓ Branch 0 taken 2295942 times.
✓ Branch 1 taken 16048 times.
|
2311990 | get_qr(qr_HARDCODED_LITEM_LTMS) |
| 2263 | ? iCompass | ||
| 2264 | 16048 | : getHighestLevelEvenUnowned(itemsbuf, itype_compass); | |
| 2265 |
2/4✓ Branch 0 taken 2311990 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2311990 times.
|
2311990 | if(itemid > -1 && checkbunny(itemid)) |
| 2266 | 2311990 | tile+=itemsbuf[itemid].ltm; | |
| 2267 | 2311990 | } | |
| 2268 | |||
| 2269 |
2/2✓ Branch 0 taken 1285701 times.
✓ Branch 1 taken 3086416 times.
|
4372117 | if(current_item(itype_bosskey)) |
| 2270 | { | ||
| 2271 | 3086416 | int32_t itemid = | |
| 2272 |
2/2✓ Branch 0 taken 2993139 times.
✓ Branch 1 taken 93277 times.
|
3086416 | get_qr(qr_HARDCODED_LITEM_LTMS) |
| 2273 | ? iBossKey | ||
| 2274 | 93277 | : getHighestLevelEvenUnowned(itemsbuf, itype_bosskey); | |
| 2275 |
2/4✓ Branch 0 taken 3086416 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 3086416 times.
|
3086416 | if(itemid > -1 && checkbunny(itemid)) |
| 2276 | 3086416 | tile+=itemsbuf[itemid].ltm; | |
| 2277 | 3086416 | } | |
| 2278 | |||
| 2279 |
2/2✓ Branch 0 taken 48263 times.
✓ Branch 1 taken 4323854 times.
|
4372117 | if(current_item(itype_magiccontainer)) |
| 2280 | { | ||
| 2281 | 4323854 | int32_t itemid = | |
| 2282 |
2/2✓ Branch 0 taken 3893055 times.
✓ Branch 1 taken 430799 times.
|
4323854 | get_qr(qr_HARDCODED_LITEM_LTMS) |
| 2283 | ? iMagicC | ||
| 2284 | 430799 | : getHighestLevelEvenUnowned(itemsbuf, itype_magiccontainer); | |
| 2285 |
3/4✓ Branch 0 taken 4323854 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
✓ Branch 3 taken 4323837 times.
|
4323854 | if(itemid > -1 && checkbunny(itemid)) |
| 2286 | 4323837 | tile+=itemsbuf[itemid].ltm; | |
| 2287 | 4323854 | } | |
| 2288 | |||
| 2289 |
2/2✓ Branch 0 taken 1302930 times.
✓ Branch 1 taken 3069187 times.
|
4372117 | if(current_item(itype_triforcepiece)) |
| 2290 | { | ||
| 2291 | 3069187 | int32_t itemid = | |
| 2292 |
1/2✓ Branch 0 taken 3069187 times.
✗ Branch 1 not taken.
|
3069187 | get_qr(qr_HARDCODED_LITEM_LTMS) |
| 2293 | ? iTriforce | ||
| 2294 | ✗ | : getHighestLevelEvenUnowned(itemsbuf, itype_triforcepiece); | |
| 2295 |
2/4✓ Branch 0 taken 3069187 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 3069187 times.
|
3069187 | if(itemid > -1 && checkbunny(itemid)) |
| 2296 | 3069187 | tile+=itemsbuf[itemid].ltm; | |
| 2297 | 3069187 | } | |
| 2298 | |||
| 2299 |
2/2✓ Branch 0 taken 2238523904 times.
✓ Branch 1 taken 4372117 times.
|
2242896021 | for(int32_t i=0; i<itype_max; i++) |
| 2300 | { | ||
| 2301 |
2/2✓ Branch 0 taken 2017847296 times.
✓ Branch 1 taken 220676608 times.
|
2238523904 | if(!get_qr(qr_HARDCODED_LITEM_LTMS)) |
| 2302 | { | ||
| 2303 |
2/2✓ Branch 0 taken 4310090 times.
✓ Branch 1 taken 216366518 times.
|
220676608 | switch(i) |
| 2304 | { | ||
| 2305 | case itype_bomb: | ||
| 2306 | case itype_sbomb: | ||
| 2307 | case itype_clock: | ||
| 2308 | case itype_key: | ||
| 2309 | case itype_lkey: | ||
| 2310 | case itype_map: | ||
| 2311 | case itype_compass: | ||
| 2312 | case itype_bosskey: | ||
| 2313 | case itype_magiccontainer: | ||
| 2314 | case itype_triforcepiece: | ||
| 2315 | 4310090 | continue; //already handled | |
| 2316 | } | ||
| 2317 | 216366518 | } | |
| 2318 | 2234213814 | int32_t itemid = current_item_id(i,false); | |
| 2319 |
2/2✓ Branch 0 taken 2229841697 times.
✓ Branch 1 taken 4372117 times.
|
2234213814 | if(i == itype_shield) |
| 2320 | 4372117 | itemid = getCurrentShield(false); | |
| 2321 | |||
| 2322 |
4/4✓ Branch 0 taken 114055178 times.
✓ Branch 1 taken 2120158636 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 114055177 times.
|
2234213814 | if(itemid < 0 || !checkbunny(itemid)) |
| 2323 | 2120158637 | continue; | |
| 2324 | |||
| 2325 | 114055177 | itemdata const& itm = itemsbuf[itemid]; | |
| 2326 | |||
| 2327 |
2/2✓ Branch 0 taken 110392554 times.
✓ Branch 1 taken 3662623 times.
|
114055177 | switch(itm.family) |
| 2328 | { | ||
| 2329 | case itype_shield: | ||
| 2330 |
1/2✓ Branch 0 taken 3662623 times.
✗ Branch 1 not taken.
|
3662623 | if(itm.flags & item_flag9) //active shield |
| 2331 | { | ||
| 2332 | ✗ | if(!usingActiveShield(itemid)) | |
| 2333 | { | ||
| 2334 | ✗ | tile+=itm.misc6; //'Inactive PTM' | |
| 2335 | ✗ | continue; | |
| 2336 | } | ||
| 2337 | ✗ | } | |
| 2338 | 3662623 | break; | |
| 2339 | } | ||
| 2340 | |||
| 2341 | 114055177 | tile+=itm.ltm; | |
| 2342 | 114055177 | } | |
| 2343 | |||
| 2344 | 4372117 | tilemod_cache_value = tile; | |
| 2345 | 4372117 | tilemod_cache_state = state; | |
| 2346 | 4372117 | return tile; | |
| 2347 | 12785648 | } | |
| 2348 | |||
| 2349 | 12785648 | int32_t bunny_tile_mod() | |
| 2350 | { | ||
| 2351 |
2/2✓ Branch 0 taken 1870 times.
✓ Branch 1 taken 12783778 times.
|
12785648 | if(Hero.BunnyClock()) |
| 2352 | { | ||
| 2353 | 1870 | return game->get_bunny_ltm(); | |
| 2354 | } | ||
| 2355 | 12783778 | return 0; | |
| 2356 | 12785648 | } | |
| 2357 | |||
| 2358 | // Hints are drawn on a separate layer to combo reveals. | ||
| 2359 | 20010 | void draw_lens_under(BITMAP *dest, bool layer) | |
| 2360 | { | ||
| 2361 | //Lens flag 1: Replacement for qr_LENSHINTS; if set, lens will show hints. Does nothing if flag 2 is set. | ||
| 2362 | //Lens flag 2: Disable "hints", prevent rendering of Secret Combos | ||
| 2363 | //Lens flag 3: Don't show armos/chest/dive items | ||
| 2364 | //Lens flag 4: Show Raft Paths | ||
| 2365 | //Lens flag 5: Show Invisible Enemies | ||
| 2366 |
4/4✓ Branch 0 taken 456 times.
✓ Branch 1 taken 19554 times.
✓ Branch 2 taken 9777 times.
✓ Branch 3 taken 9777 times.
|
20010 | bool hints = (itemsbuf[Hero.getLastLensID()].flags & item_flag2) ? false : (layer && (itemsbuf[Hero.getLastLensID()].flags & item_flag1)); |
| 2367 | |||
| 2368 | 20010 | int32_t strike_hint_table[11]= | |
| 2369 | { | ||
| 2370 | mfARROW, mfBOMB, mfBRANG, mfWANDMAGIC, | ||
| 2371 | mfSWORD, mfREFMAGIC, mfHOOKSHOT, | ||
| 2372 | mfREFFIREBALL, mfHAMMER, mfSWORDBEAM, mfWAND | ||
| 2373 | }; | ||
| 2374 | |||
| 2375 | { | ||
| 2376 | 20010 | int32_t blink_rate=flash_reduction_enabled()?6:1; | |
| 2377 | 20010 | int32_t tempitem, tempweapon=0; | |
| 2378 | 20010 | strike_hint=strike_hint_table[strike_hint_counter]; | |
| 2379 | |||
| 2380 |
2/2✓ Branch 0 taken 19412 times.
✓ Branch 1 taken 598 times.
|
20010 | if(strike_hint_timer>32) |
| 2381 | { | ||
| 2382 | 598 | strike_hint_timer=0; | |
| 2383 | 598 | strike_hint_counter=((strike_hint_counter+1)%11); | |
| 2384 | 598 | } | |
| 2385 | |||
| 2386 | 20010 | ++strike_hint_timer; | |
| 2387 | |||
| 2388 |
2/2✓ Branch 0 taken 3521760 times.
✓ Branch 1 taken 20010 times.
|
3541770 | for(int32_t i=0; i<176; i++) |
| 2389 | { | ||
| 2390 | 3521760 | int32_t x = (i & 15) << 4; | |
| 2391 | 3521760 | int32_t y = (i & 0xF0) + playing_field_offset; | |
| 2392 | 3521760 | int32_t tempitemx=-16, tempitemy=-16; | |
| 2393 | 3521760 | int32_t tempweaponx=-16, tempweapony=-16; | |
| 2394 | |||
| 2395 |
2/2✓ Branch 0 taken 7043520 times.
✓ Branch 1 taken 3521760 times.
|
10565280 | for(int32_t iter=0; iter<2; ++iter) |
| 2396 | { | ||
| 2397 | 7043520 | int32_t checkflag=0; | |
| 2398 | |||
| 2399 |
2/2✓ Branch 0 taken 3521760 times.
✓ Branch 1 taken 3521760 times.
|
7043520 | if(iter==0) |
| 2400 | { | ||
| 2401 | 3521760 | checkflag=combobuf[tmpscr->data[i]].flag; | |
| 2402 | 3521760 | } | |
| 2403 | else | ||
| 2404 | { | ||
| 2405 | 3521760 | checkflag=tmpscr->sflag[i]; | |
| 2406 | } | ||
| 2407 | |||
| 2408 |
2/2✓ Branch 0 taken 7042422 times.
✓ Branch 1 taken 1098 times.
|
7043520 | if(checkflag==mfSTRIKE) |
| 2409 | { | ||
| 2410 |
2/2✓ Branch 0 taken 192 times.
✓ Branch 1 taken 906 times.
|
1098 | if(!hints) |
| 2411 | { | ||
| 2412 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 906 times.
|
906 | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,tmpscr->secretcombo[sSTRIKE],tmpscr->secretcset[sSTRIKE]); |
| 2413 | 906 | } | |
| 2414 | else | ||
| 2415 | { | ||
| 2416 | 192 | checkflag = strike_hint; | |
| 2417 | } | ||
| 2418 | 1098 | } | |
| 2419 | |||
| 2420 |
21/36✓ Branch 0 taken 6894870 times.
✓ Branch 1 taken 3258 times.
✓ Branch 2 taken 108898 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2602 times.
✓ Branch 5 taken 28750 times.
✓ Branch 6 taken 2418 times.
✓ Branch 7 taken 504 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 814 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✓ Branch 14 taken 93 times.
✓ Branch 15 taken 96 times.
✓ Branch 16 taken 24 times.
✓ Branch 17 taken 25 times.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✓ Branch 20 taken 138 times.
✓ Branch 21 taken 16 times.
✓ Branch 22 taken 16 times.
✓ Branch 23 taken 7 times.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✓ Branch 27 taken 16 times.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✓ Branch 31 taken 17 times.
✓ Branch 32 taken 35 times.
✓ Branch 33 taken 17 times.
✗ Branch 34 not taken.
✓ Branch 35 taken 906 times.
|
7043520 | switch(checkflag) |
| 2421 | { | ||
| 2422 | case 0: | ||
| 2423 | case mfZELDA: | ||
| 2424 | case mfPUSHED: | ||
| 2425 | case mfENEMY0: | ||
| 2426 | case mfENEMY1: | ||
| 2427 | case mfENEMY2: | ||
| 2428 | case mfENEMY3: | ||
| 2429 | case mfENEMY4: | ||
| 2430 | case mfENEMY5: | ||
| 2431 | case mfENEMY6: | ||
| 2432 | case mfENEMY7: | ||
| 2433 | case mfENEMY8: | ||
| 2434 | case mfENEMY9: | ||
| 2435 | case mfSINGLE: | ||
| 2436 | case mfSINGLE16: | ||
| 2437 | case mfNOENEMY: | ||
| 2438 | case mfTRAP_H: | ||
| 2439 | case mfTRAP_V: | ||
| 2440 | case mfTRAP_4: | ||
| 2441 | case mfTRAP_LR: | ||
| 2442 | case mfTRAP_UD: | ||
| 2443 | case mfNOGROUNDENEMY: | ||
| 2444 | case mfNOBLOCKS: | ||
| 2445 | case mfSCRIPT1: | ||
| 2446 | case mfSCRIPT2: | ||
| 2447 | case mfSCRIPT3: | ||
| 2448 | case mfSCRIPT4: | ||
| 2449 | case mfSCRIPT5: | ||
| 2450 | case mfSCRIPT6: | ||
| 2451 | case mfSCRIPT7: | ||
| 2452 | case mfSCRIPT8: | ||
| 2453 | case mfSCRIPT9: | ||
| 2454 | case mfSCRIPT10: | ||
| 2455 | case mfSCRIPT11: | ||
| 2456 | case mfSCRIPT12: | ||
| 2457 | case mfSCRIPT13: | ||
| 2458 | case mfSCRIPT14: | ||
| 2459 | case mfSCRIPT15: | ||
| 2460 | case mfSCRIPT16: | ||
| 2461 | case mfSCRIPT17: | ||
| 2462 | case mfSCRIPT18: | ||
| 2463 | case mfSCRIPT19: | ||
| 2464 | case mfSCRIPT20: | ||
| 2465 | case mfPITHOLE: | ||
| 2466 | case mfPITFALLFLOOR: | ||
| 2467 | case mfLAVA: | ||
| 2468 | case mfICE: | ||
| 2469 | case mfICEDAMAGE: | ||
| 2470 | case mfDAMAGE1: | ||
| 2471 | case mfDAMAGE2: | ||
| 2472 | case mfDAMAGE4: | ||
| 2473 | case mfDAMAGE8: | ||
| 2474 | case mfDAMAGE16: | ||
| 2475 | case mfDAMAGE32: | ||
| 2476 | case mfFREEZEALL: | ||
| 2477 | case mfFREZEALLANSFFCS: | ||
| 2478 | case mfFREEZEFFCSOLY: | ||
| 2479 | case mfSCRITPTW1TRIG: | ||
| 2480 | case mfSCRITPTW2TRIG: | ||
| 2481 | case mfSCRITPTW3TRIG: | ||
| 2482 | case mfSCRITPTW4TRIG: | ||
| 2483 | case mfSCRITPTW5TRIG: | ||
| 2484 | case mfSCRITPTW6TRIG: | ||
| 2485 | case mfSCRITPTW7TRIG: | ||
| 2486 | case mfSCRITPTW8TRIG: | ||
| 2487 | case mfSCRITPTW9TRIG: | ||
| 2488 | case mfSCRITPTW10TRIG: | ||
| 2489 | case mfTROWEL: | ||
| 2490 | case mfTROWELNEXT: | ||
| 2491 | case mfTROWELSPECIALITEM: | ||
| 2492 | case mfSLASHPOT: | ||
| 2493 | case mfLIFTPOT: | ||
| 2494 | case mfLIFTORSLASH: | ||
| 2495 | case mfLIFTROCK: | ||
| 2496 | case mfLIFTROCKHEAVY: | ||
| 2497 | case mfDROPITEM: | ||
| 2498 | case mfSPECIALITEM: | ||
| 2499 | case mfDROPKEY: | ||
| 2500 | case mfDROPLKEY: | ||
| 2501 | case mfDROPCOMPASS: | ||
| 2502 | case mfDROPMAP: | ||
| 2503 | case mfDROPBOSSKEY: | ||
| 2504 | case mfSPAWNNPC: | ||
| 2505 | case mfSWITCHHOOK: | ||
| 2506 | case mfSIDEVIEWLADDER: | ||
| 2507 | case mfSIDEVIEWPLATFORM: | ||
| 2508 | case mfNOENEMYSPAWN: | ||
| 2509 | case mfENEMYALL: | ||
| 2510 | case mfNOMIRROR: | ||
| 2511 | case mfUNSAFEGROUND: | ||
| 2512 | case mf168: | ||
| 2513 | case mf169: | ||
| 2514 | case mf170: | ||
| 2515 | case mf171: | ||
| 2516 | case mf172: | ||
| 2517 | case mf173: | ||
| 2518 | case mf174: | ||
| 2519 | case mf175: | ||
| 2520 | case mf176: | ||
| 2521 | case mf177: | ||
| 2522 | case mf178: | ||
| 2523 | case mf179: | ||
| 2524 | case mf180: | ||
| 2525 | case mf181: | ||
| 2526 | case mf182: | ||
| 2527 | case mf183: | ||
| 2528 | case mf184: | ||
| 2529 | case mf185: | ||
| 2530 | case mf186: | ||
| 2531 | case mf187: | ||
| 2532 | case mf188: | ||
| 2533 | case mf189: | ||
| 2534 | case mf190: | ||
| 2535 | case mf191: | ||
| 2536 | case mf192: | ||
| 2537 | case mf193: | ||
| 2538 | case mf194: | ||
| 2539 | case mf195: | ||
| 2540 | case mf196: | ||
| 2541 | case mf197: | ||
| 2542 | case mf198: | ||
| 2543 | case mf199: | ||
| 2544 | case mf200: | ||
| 2545 | case mf201: | ||
| 2546 | case mf202: | ||
| 2547 | case mf203: | ||
| 2548 | case mf204: | ||
| 2549 | case mf205: | ||
| 2550 | case mf206: | ||
| 2551 | case mf207: | ||
| 2552 | case mf208: | ||
| 2553 | case mf209: | ||
| 2554 | case mf210: | ||
| 2555 | case mf211: | ||
| 2556 | case mf212: | ||
| 2557 | case mf213: | ||
| 2558 | case mf214: | ||
| 2559 | case mf215: | ||
| 2560 | case mf216: | ||
| 2561 | case mf217: | ||
| 2562 | case mf218: | ||
| 2563 | case mf219: | ||
| 2564 | case mf220: | ||
| 2565 | case mf221: | ||
| 2566 | case mf222: | ||
| 2567 | case mf223: | ||
| 2568 | case mf224: | ||
| 2569 | case mf225: | ||
| 2570 | case mf226: | ||
| 2571 | case mf227: | ||
| 2572 | case mf228: | ||
| 2573 | case mf229: | ||
| 2574 | case mf230: | ||
| 2575 | case mf231: | ||
| 2576 | case mf232: | ||
| 2577 | case mf233: | ||
| 2578 | case mf234: | ||
| 2579 | case mf235: | ||
| 2580 | case mf236: | ||
| 2581 | case mf237: | ||
| 2582 | case mf238: | ||
| 2583 | case mf239: | ||
| 2584 | case mf240: | ||
| 2585 | case mf241: | ||
| 2586 | case mf242: | ||
| 2587 | case mf243: | ||
| 2588 | case mf244: | ||
| 2589 | case mf245: | ||
| 2590 | case mf246: | ||
| 2591 | case mf247: | ||
| 2592 | case mf248: | ||
| 2593 | case mf249: | ||
| 2594 | case mf250: | ||
| 2595 | case mf251: | ||
| 2596 | case mf252: | ||
| 2597 | case mf253: | ||
| 2598 | case mf254: | ||
| 2599 | case mfEXTENDED: | ||
| 2600 | 6894870 | break; | |
| 2601 | |||
| 2602 | case mfPUSHUD: | ||
| 2603 | case mfPUSHLR: | ||
| 2604 | case mfPUSH4: | ||
| 2605 | case mfPUSHU: | ||
| 2606 | case mfPUSHD: | ||
| 2607 | case mfPUSHL: | ||
| 2608 | case mfPUSHR: | ||
| 2609 | case mfPUSHUDNS: | ||
| 2610 | case mfPUSHLRNS: | ||
| 2611 | case mfPUSH4NS: | ||
| 2612 | case mfPUSHUNS: | ||
| 2613 | case mfPUSHDNS: | ||
| 2614 | case mfPUSHLNS: | ||
| 2615 | case mfPUSHRNS: | ||
| 2616 | case mfPUSHUDINS: | ||
| 2617 | case mfPUSHLRINS: | ||
| 2618 | case mfPUSH4INS: | ||
| 2619 | case mfPUSHUINS: | ||
| 2620 | case mfPUSHDINS: | ||
| 2621 | case mfPUSHLINS: | ||
| 2622 | case mfPUSHRINS: | ||
| 2623 |
3/4✓ Branch 0 taken 1939 times.
✓ Branch 1 taken 1319 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1939 times.
|
3258 | if(!hints && ((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&16)) |
| 2624 |
2/6✗ Branch 0 not taken.
✓ Branch 1 taken 1939 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1939 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1939 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&16)))) |
| 2625 | { | ||
| 2626 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,tmpscr->undercombo,tmpscr->undercset); | |
| 2627 | ✗ | } | |
| 2628 | |||
| 2629 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3258 times.
|
3258 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 2630 |
3/6✓ Branch 0 taken 2520 times.
✓ Branch 1 taken 738 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 738 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
3258 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 2631 | { | ||
| 2632 |
2/2✓ Branch 0 taken 1488 times.
✓ Branch 1 taken 1032 times.
|
2520 | if(hints) |
| 2633 | { | ||
| 2634 |
3/3✓ Branch 0 taken 72 times.
✓ Branch 1 taken 63 times.
✓ Branch 2 taken 897 times.
|
1032 | switch(combobuf[tmpscr->data[i]].type) |
| 2635 | { | ||
| 2636 | case cPUSH_HEAVY: | ||
| 2637 | case cPUSH_HW: | ||
| 2638 | 72 | tempitem=getItemIDPower(itemsbuf,itype_bracelet,1); | |
| 2639 | 72 | tempitemx=x, tempitemy=y; | |
| 2640 | |||
| 2641 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 72 times.
|
72 | if(tempitem>-1) |
| 2642 | 72 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2643 | |||
| 2644 | 72 | break; | |
| 2645 | |||
| 2646 | case cPUSH_HEAVY2: | ||
| 2647 | case cPUSH_HW2: | ||
| 2648 | 63 | tempitem=getItemIDPower(itemsbuf,itype_bracelet,2); | |
| 2649 | 63 | tempitemx=x, tempitemy=y; | |
| 2650 | |||
| 2651 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 63 times.
|
63 | if(tempitem>-1) |
| 2652 | 63 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2653 | |||
| 2654 | 63 | break; | |
| 2655 | } | ||
| 2656 | 1032 | } | |
| 2657 | 2520 | } | |
| 2658 | |||
| 2659 | 3258 | break; | |
| 2660 | |||
| 2661 | case mfWHISTLE: | ||
| 2662 |
1/2✓ Branch 0 taken 2418 times.
✗ Branch 1 not taken.
|
2418 | if(hints) |
| 2663 | { | ||
| 2664 | ✗ | tempitem=getItemID(itemsbuf,itype_whistle,1); | |
| 2665 | |||
| 2666 | ✗ | if(tempitem<0) break; | |
| 2667 | |||
| 2668 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 2669 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 2670 | { | ||
| 2671 | ✗ | tempitemx=x; | |
| 2672 | ✗ | tempitemy=y; | |
| 2673 | ✗ | } | |
| 2674 | |||
| 2675 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2676 | ✗ | } | |
| 2677 | |||
| 2678 | 2418 | break; | |
| 2679 | |||
| 2680 | //Why is this here? | ||
| 2681 | case mfFAIRY: | ||
| 2682 | case mfMAGICFAIRY: | ||
| 2683 | case mfALLFAIRY: | ||
| 2684 | ✗ | if(hints) | |
| 2685 | { | ||
| 2686 | ✗ | tempitem=getItemID(itemsbuf, itype_fairy,1);//iFairyMoving; | |
| 2687 | |||
| 2688 | ✗ | if(tempitem < 0) break; | |
| 2689 | |||
| 2690 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 2691 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 2692 | { | ||
| 2693 | ✗ | tempitemx=x; | |
| 2694 | ✗ | tempitemy=y; | |
| 2695 | ✗ | } | |
| 2696 | |||
| 2697 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2698 | ✗ | } | |
| 2699 | |||
| 2700 | ✗ | break; | |
| 2701 | |||
| 2702 | case mfANYFIRE: | ||
| 2703 |
2/2✓ Branch 0 taken 252 times.
✓ Branch 1 taken 252 times.
|
504 | if(!hints) |
| 2704 | { | ||
| 2705 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 252 times.
|
252 | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,tmpscr->secretcombo[sBCANDLE],tmpscr->secretcset[sBCANDLE]); |
| 2706 | 252 | } | |
| 2707 | else | ||
| 2708 | { | ||
| 2709 | 252 | tempitem=getItemID(itemsbuf,itype_candle,1); | |
| 2710 | |||
| 2711 |
1/2✓ Branch 0 taken 252 times.
✗ Branch 1 not taken.
|
252 | if(tempitem<0) break; |
| 2712 | |||
| 2713 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 252 times.
|
252 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 2714 |
3/6✓ Branch 0 taken 189 times.
✓ Branch 1 taken 63 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 63 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
252 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 2715 | { | ||
| 2716 | 189 | tempitemx=x; | |
| 2717 | 189 | tempitemy=y; | |
| 2718 | 189 | } | |
| 2719 | |||
| 2720 | 252 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2721 | } | ||
| 2722 | |||
| 2723 | 504 | break; | |
| 2724 | |||
| 2725 | case mfSTRONGFIRE: | ||
| 2726 | ✗ | if(!hints) | |
| 2727 | { | ||
| 2728 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,tmpscr->secretcombo[sRCANDLE],tmpscr->secretcset[sRCANDLE]); | |
| 2729 | ✗ | } | |
| 2730 | else | ||
| 2731 | { | ||
| 2732 | ✗ | tempitem=getItemID(itemsbuf,itype_candle,2); | |
| 2733 | |||
| 2734 | ✗ | if(tempitem<0) break; | |
| 2735 | |||
| 2736 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 2737 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 2738 | { | ||
| 2739 | ✗ | tempitemx=x; | |
| 2740 | ✗ | tempitemy=y; | |
| 2741 | ✗ | } | |
| 2742 | |||
| 2743 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2744 | } | ||
| 2745 | |||
| 2746 | ✗ | break; | |
| 2747 | |||
| 2748 | case mfMAGICFIRE: | ||
| 2749 | ✗ | if(!hints) | |
| 2750 | { | ||
| 2751 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,tmpscr->secretcombo[sWANDFIRE],tmpscr->secretcset[sWANDFIRE]); | |
| 2752 | ✗ | } | |
| 2753 | else | ||
| 2754 | { | ||
| 2755 | ✗ | tempitem=getItemID(itemsbuf,itype_wand,1); | |
| 2756 | |||
| 2757 | ✗ | if(tempitem<0) break; | |
| 2758 | |||
| 2759 | ✗ | tempweapon=wFire; | |
| 2760 | |||
| 2761 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 2762 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 2763 | { | ||
| 2764 | ✗ | tempitemx=x; | |
| 2765 | ✗ | tempitemy=y; | |
| 2766 | ✗ | } | |
| 2767 | else | ||
| 2768 | { | ||
| 2769 | ✗ | tempweaponx=x; | |
| 2770 | ✗ | tempweapony=y; | |
| 2771 | } | ||
| 2772 | |||
| 2773 | ✗ | putweapon(dest,tempweaponx,tempweapony,tempweapon, 0, up, lens_hint_weapon[tempweapon][0], lens_hint_weapon[tempweapon][1],-1); | |
| 2774 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2775 | } | ||
| 2776 | |||
| 2777 | ✗ | break; | |
| 2778 | |||
| 2779 | case mfDIVINEFIRE: | ||
| 2780 | ✗ | if(!hints) | |
| 2781 | { | ||
| 2782 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,tmpscr->secretcombo[sDIVINEFIRE],tmpscr->secretcset[sDIVINEFIRE]); | |
| 2783 | ✗ | } | |
| 2784 | else | ||
| 2785 | { | ||
| 2786 | ✗ | tempitem=getItemID(itemsbuf,itype_divinefire,1); | |
| 2787 | |||
| 2788 | ✗ | if(tempitem<0) break; | |
| 2789 | |||
| 2790 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 2791 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 2792 | { | ||
| 2793 | ✗ | tempitemx=x; | |
| 2794 | ✗ | tempitemy=y; | |
| 2795 | ✗ | } | |
| 2796 | |||
| 2797 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2798 | } | ||
| 2799 | |||
| 2800 | ✗ | break; | |
| 2801 | |||
| 2802 | case mfARROW: | ||
| 2803 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 732 times.
|
814 | if(!hints) |
| 2804 | { | ||
| 2805 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 732 times.
|
732 | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,tmpscr->secretcombo[sARROW],tmpscr->secretcset[sARROW]); |
| 2806 | 732 | } | |
| 2807 | else | ||
| 2808 | { | ||
| 2809 | 82 | tempitem=getItemID(itemsbuf,itype_arrow,1); | |
| 2810 | |||
| 2811 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | if(tempitem<0) break; |
| 2812 | |||
| 2813 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 82 times.
|
82 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 2814 |
3/6✓ Branch 0 taken 61 times.
✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 21 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
82 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 2815 | { | ||
| 2816 | 61 | tempitemx=x; | |
| 2817 | 61 | tempitemy=y; | |
| 2818 | 61 | } | |
| 2819 | |||
| 2820 | 82 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2821 | } | ||
| 2822 | |||
| 2823 | 814 | break; | |
| 2824 | |||
| 2825 | case mfSARROW: | ||
| 2826 | ✗ | if(!hints) | |
| 2827 | { | ||
| 2828 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,tmpscr->secretcombo[sSARROW],tmpscr->secretcset[sSARROW]); | |
| 2829 | ✗ | } | |
| 2830 | else | ||
| 2831 | { | ||
| 2832 | ✗ | tempitem=getItemID(itemsbuf,itype_arrow,2); | |
| 2833 | |||
| 2834 | ✗ | if(tempitem<0) break; | |
| 2835 | |||
| 2836 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 2837 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 2838 | { | ||
| 2839 | ✗ | tempitemx=x; | |
| 2840 | ✗ | tempitemy=y; | |
| 2841 | ✗ | } | |
| 2842 | |||
| 2843 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2844 | } | ||
| 2845 | |||
| 2846 | ✗ | break; | |
| 2847 | |||
| 2848 | case mfGARROW: | ||
| 2849 | ✗ | if(!hints) | |
| 2850 | { | ||
| 2851 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,tmpscr->secretcombo[sGARROW],tmpscr->secretcset[sGARROW]); | |
| 2852 | ✗ | } | |
| 2853 | else | ||
| 2854 | { | ||
| 2855 | ✗ | tempitem=getItemID(itemsbuf,itype_arrow,3); | |
| 2856 | |||
| 2857 | ✗ | if(tempitem<0) break; | |
| 2858 | |||
| 2859 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 2860 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 2861 | { | ||
| 2862 | ✗ | tempitemx=x; | |
| 2863 | ✗ | tempitemy=y; | |
| 2864 | ✗ | } | |
| 2865 | |||
| 2866 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2867 | } | ||
| 2868 | |||
| 2869 | ✗ | break; | |
| 2870 | |||
| 2871 | case mfBOMB: | ||
| 2872 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 76 times.
|
93 | if(!hints) |
| 2873 | { | ||
| 2874 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 76 times.
|
76 | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,tmpscr->secretcombo[sBOMB],tmpscr->secretcset[sBOMB]); |
| 2875 | 76 | } | |
| 2876 | else | ||
| 2877 | { | ||
| 2878 | //tempitem=getItemID(itemsbuf,itype_bomb,1); | ||
| 2879 | 17 | tempweapon = wLitBomb; | |
| 2880 | |||
| 2881 | //if (tempitem<0) break; | ||
| 2882 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
|
17 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 2883 |
3/6✓ Branch 0 taken 12 times.
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
17 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 2884 | { | ||
| 2885 | 12 | tempweaponx=x; | |
| 2886 | 12 | tempweapony=y; | |
| 2887 | 12 | } | |
| 2888 | |||
| 2889 | 17 | putweapon(dest,tempweaponx,tempweapony+lens_hint_weapon[tempweapon][4],tempweapon, 0, up, lens_hint_weapon[tempweapon][0], lens_hint_weapon[tempweapon][1],-1); | |
| 2890 | } | ||
| 2891 | |||
| 2892 | 93 | break; | |
| 2893 | |||
| 2894 | case mfSBOMB: | ||
| 2895 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 48 times.
|
96 | if(!hints) |
| 2896 | { | ||
| 2897 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
|
48 | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,tmpscr->secretcombo[sSBOMB],tmpscr->secretcset[sSBOMB]); |
| 2898 | 48 | } | |
| 2899 | else | ||
| 2900 | { | ||
| 2901 | //tempitem=getItemID(itemsbuf,itype_sbomb,1); | ||
| 2902 | //if (tempitem<0) break; | ||
| 2903 | 48 | tempweapon = wLitSBomb; | |
| 2904 | |||
| 2905 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
|
48 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 2906 |
3/6✓ Branch 0 taken 36 times.
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 12 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
48 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 2907 | { | ||
| 2908 | 36 | tempweaponx=x; | |
| 2909 | 36 | tempweapony=y; | |
| 2910 | 36 | } | |
| 2911 | |||
| 2912 | 48 | putweapon(dest,tempweaponx,tempweapony+lens_hint_weapon[tempweapon][4],tempweapon, 0, up, lens_hint_weapon[tempweapon][0], lens_hint_weapon[tempweapon][1],-1); | |
| 2913 | } | ||
| 2914 | |||
| 2915 | 96 | break; | |
| 2916 | |||
| 2917 | case mfARMOS_SECRET: | ||
| 2918 |
2/2✓ Branch 0 taken 12 times.
✓ Branch 1 taken 12 times.
|
24 | if(!hints) |
| 2919 | { | ||
| 2920 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
12 | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,tmpscr->secretcombo[sSTAIRS],tmpscr->secretcset[sSTAIRS]); |
| 2921 | 12 | } | |
| 2922 | 24 | break; | |
| 2923 | |||
| 2924 | case mfBRANG: | ||
| 2925 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 20 times.
|
25 | if(!hints) |
| 2926 | { | ||
| 2927 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
|
20 | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,tmpscr->secretcombo[sBRANG],tmpscr->secretcset[sBRANG]); |
| 2928 | 20 | } | |
| 2929 | else | ||
| 2930 | { | ||
| 2931 | 5 | tempitem=getItemID(itemsbuf,itype_brang,1); | |
| 2932 | |||
| 2933 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if(tempitem<0) break; |
| 2934 | |||
| 2935 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
|
5 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 2936 |
3/6✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
5 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 2937 | { | ||
| 2938 | 4 | tempitemx=x; | |
| 2939 | 4 | tempitemy=y; | |
| 2940 | 4 | } | |
| 2941 | |||
| 2942 | 5 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2943 | } | ||
| 2944 | |||
| 2945 | 25 | break; | |
| 2946 | |||
| 2947 | case mfMBRANG: | ||
| 2948 | ✗ | if(!hints) | |
| 2949 | { | ||
| 2950 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,tmpscr->secretcombo[sMBRANG],tmpscr->secretcset[sMBRANG]); | |
| 2951 | ✗ | } | |
| 2952 | else | ||
| 2953 | { | ||
| 2954 | ✗ | tempitem=getItemID(itemsbuf,itype_brang,2); | |
| 2955 | |||
| 2956 | ✗ | if(tempitem<0) break; | |
| 2957 | |||
| 2958 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 2959 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 2960 | { | ||
| 2961 | ✗ | tempitemx=x; | |
| 2962 | ✗ | tempitemy=y; | |
| 2963 | ✗ | } | |
| 2964 | |||
| 2965 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2966 | } | ||
| 2967 | |||
| 2968 | ✗ | break; | |
| 2969 | |||
| 2970 | case mfFBRANG: | ||
| 2971 | ✗ | if(!hints) | |
| 2972 | { | ||
| 2973 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,tmpscr->secretcombo[sFBRANG],tmpscr->secretcset[sFBRANG]); | |
| 2974 | ✗ | } | |
| 2975 | else | ||
| 2976 | { | ||
| 2977 | ✗ | tempitem=getItemID(itemsbuf,itype_brang,3); | |
| 2978 | |||
| 2979 | ✗ | if(tempitem<0) break; | |
| 2980 | |||
| 2981 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 2982 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 2983 | { | ||
| 2984 | ✗ | tempitemx=x; | |
| 2985 | ✗ | tempitemy=y; | |
| 2986 | ✗ | } | |
| 2987 | |||
| 2988 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2989 | } | ||
| 2990 | |||
| 2991 | ✗ | break; | |
| 2992 | |||
| 2993 | case mfWANDMAGIC: | ||
| 2994 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 138 times.
|
138 | if(!hints) |
| 2995 | { | ||
| 2996 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 138 times.
|
138 | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,tmpscr->secretcombo[sWANDMAGIC],tmpscr->secretcset[sWANDMAGIC]); |
| 2997 | 138 | } | |
| 2998 | else | ||
| 2999 | { | ||
| 3000 | ✗ | tempitem=getItemID(itemsbuf,itype_wand,1); | |
| 3001 | |||
| 3002 | ✗ | if(tempitem<0) break; | |
| 3003 | |||
| 3004 | ✗ | tempweapon=itemsbuf[tempitem].wpn3; | |
| 3005 | |||
| 3006 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 3007 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 3008 | { | ||
| 3009 | ✗ | tempitemx=x; | |
| 3010 | ✗ | tempitemy=y; | |
| 3011 | ✗ | } | |
| 3012 | else | ||
| 3013 | { | ||
| 3014 | ✗ | tempweaponx=x; | |
| 3015 | ✗ | tempweapony=y; | |
| 3016 | ✗ | --lens_hint_weapon[wMagic][4]; | |
| 3017 | |||
| 3018 | ✗ | if(lens_hint_weapon[wMagic][4]<-8) | |
| 3019 | { | ||
| 3020 | ✗ | lens_hint_weapon[wMagic][4]=8; | |
| 3021 | ✗ | } | |
| 3022 | } | ||
| 3023 | |||
| 3024 | ✗ | putweapon(dest,tempweaponx,tempweapony+lens_hint_weapon[tempweapon][4],tempweapon, 0, up, lens_hint_weapon[tempweapon][0], lens_hint_weapon[tempweapon][1],-1); | |
| 3025 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3026 | } | ||
| 3027 | |||
| 3028 | 138 | break; | |
| 3029 | |||
| 3030 | case mfREFMAGIC: | ||
| 3031 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!hints) |
| 3032 | { | ||
| 3033 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,tmpscr->secretcombo[sREFMAGIC],tmpscr->secretcset[sREFMAGIC]); | |
| 3034 | ✗ | } | |
| 3035 | else | ||
| 3036 | { | ||
| 3037 | 16 | tempitem=getItemID(itemsbuf,itype_shield,3); | |
| 3038 | |||
| 3039 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(tempitem<0) break; |
| 3040 | |||
| 3041 | 16 | tempweapon=ewMagic; | |
| 3042 | |||
| 3043 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
|
16 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 3044 |
3/6✓ Branch 0 taken 13 times.
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
16 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 3045 | { | ||
| 3046 | 13 | tempitemx=x; | |
| 3047 | 13 | tempitemy=y; | |
| 3048 | 13 | } | |
| 3049 | else | ||
| 3050 | { | ||
| 3051 | 3 | tempweaponx=x; | |
| 3052 | 3 | tempweapony=y; | |
| 3053 | |||
| 3054 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 times.
|
3 | if(lens_hint_weapon[ewMagic][2]==up) |
| 3055 | { | ||
| 3056 | 1 | --lens_hint_weapon[ewMagic][4]; | |
| 3057 | 1 | } | |
| 3058 | else | ||
| 3059 | { | ||
| 3060 | 2 | ++lens_hint_weapon[ewMagic][4]; | |
| 3061 | } | ||
| 3062 | |||
| 3063 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if(lens_hint_weapon[ewMagic][4]>8) |
| 3064 | { | ||
| 3065 | ✗ | lens_hint_weapon[ewMagic][2]=up; | |
| 3066 | ✗ | } | |
| 3067 | |||
| 3068 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2 times.
|
3 | if(lens_hint_weapon[ewMagic][4]<=0) |
| 3069 | { | ||
| 3070 | 2 | lens_hint_weapon[ewMagic][2]=down; | |
| 3071 | 2 | } | |
| 3072 | } | ||
| 3073 | |||
| 3074 | 16 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3075 | 16 | putweapon(dest,tempweaponx,tempweapony+lens_hint_weapon[tempweapon][4],tempweapon, 0, lens_hint_weapon[ewMagic][2], lens_hint_weapon[tempweapon][0], lens_hint_weapon[tempweapon][1],-1); | |
| 3076 | } | ||
| 3077 | |||
| 3078 | 16 | break; | |
| 3079 | |||
| 3080 | case mfREFFIREBALL: | ||
| 3081 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!hints) |
| 3082 | { | ||
| 3083 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,tmpscr->secretcombo[sREFFIREBALL],tmpscr->secretcset[sREFFIREBALL]); | |
| 3084 | ✗ | } | |
| 3085 | else | ||
| 3086 | { | ||
| 3087 | 16 | tempitem=getItemID(itemsbuf,itype_shield,3); | |
| 3088 | |||
| 3089 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(tempitem<0) break; |
| 3090 | |||
| 3091 | 16 | tempweapon=ewFireball; | |
| 3092 | |||
| 3093 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
|
16 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 3094 |
3/6✓ Branch 0 taken 12 times.
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
16 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 3095 | { | ||
| 3096 | 12 | tempitemx=x; | |
| 3097 | 12 | tempitemy=y; | |
| 3098 | 12 | tempweaponx=x; | |
| 3099 | 12 | tempweapony=y; | |
| 3100 | 12 | ++lens_hint_weapon[ewFireball][3]; | |
| 3101 | |||
| 3102 |
2/2✓ Branch 0 taken 11 times.
✓ Branch 1 taken 1 times.
|
12 | if(lens_hint_weapon[ewFireball][3]>8) |
| 3103 | { | ||
| 3104 | 1 | lens_hint_weapon[ewFireball][3]=-8; | |
| 3105 | 1 | lens_hint_weapon[ewFireball][4]=8; | |
| 3106 | 1 | } | |
| 3107 | |||
| 3108 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 4 times.
|
12 | if(lens_hint_weapon[ewFireball][3]>0) |
| 3109 | { | ||
| 3110 | 8 | ++lens_hint_weapon[ewFireball][4]; | |
| 3111 | 8 | } | |
| 3112 | else | ||
| 3113 | { | ||
| 3114 | 4 | --lens_hint_weapon[ewFireball][4]; | |
| 3115 | } | ||
| 3116 | 12 | } | |
| 3117 | |||
| 3118 | 16 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3119 | 16 | putweapon(dest,tempweaponx+lens_hint_weapon[tempweapon][3],tempweapony+lens_hint_weapon[ewFireball][4],tempweapon, 0, up, lens_hint_weapon[tempweapon][0], lens_hint_weapon[tempweapon][1],-1); | |
| 3120 | } | ||
| 3121 | |||
| 3122 | 16 | break; | |
| 3123 | |||
| 3124 | case mfSWORD: | ||
| 3125 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | if(!hints) |
| 3126 | { | ||
| 3127 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,tmpscr->secretcombo[sSWORD],tmpscr->secretcset[sSWORD]); | |
| 3128 | ✗ | } | |
| 3129 | else | ||
| 3130 | { | ||
| 3131 | 7 | tempitem=getItemID(itemsbuf,itype_sword,1); | |
| 3132 | |||
| 3133 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | if(tempitem<0) break; |
| 3134 | |||
| 3135 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
|
7 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 3136 |
3/6✓ Branch 0 taken 5 times.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
7 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 3137 | { | ||
| 3138 | 5 | tempitemx=x; | |
| 3139 | 5 | tempitemy=y; | |
| 3140 | 5 | } | |
| 3141 | |||
| 3142 | 7 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3143 | } | ||
| 3144 | |||
| 3145 | 7 | break; | |
| 3146 | |||
| 3147 | case mfWSWORD: | ||
| 3148 | ✗ | if(!hints) | |
| 3149 | { | ||
| 3150 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,tmpscr->secretcombo[sWSWORD],tmpscr->secretcset[sWSWORD]); | |
| 3151 | ✗ | } | |
| 3152 | else | ||
| 3153 | { | ||
| 3154 | ✗ | tempitem=getItemID(itemsbuf,itype_sword,2); | |
| 3155 | |||
| 3156 | ✗ | if(tempitem<0) break; | |
| 3157 | |||
| 3158 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 3159 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 3160 | { | ||
| 3161 | ✗ | tempitemx=x; | |
| 3162 | ✗ | tempitemy=y; | |
| 3163 | ✗ | } | |
| 3164 | |||
| 3165 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3166 | } | ||
| 3167 | |||
| 3168 | ✗ | break; | |
| 3169 | |||
| 3170 | case mfMSWORD: | ||
| 3171 | ✗ | if(!hints) | |
| 3172 | { | ||
| 3173 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,tmpscr->secretcombo[sMSWORD],tmpscr->secretcset[sMSWORD]); | |
| 3174 | ✗ | } | |
| 3175 | else | ||
| 3176 | { | ||
| 3177 | ✗ | tempitem=getItemID(itemsbuf,itype_sword,3); | |
| 3178 | |||
| 3179 | ✗ | if(tempitem<0) break; | |
| 3180 | |||
| 3181 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 3182 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 3183 | { | ||
| 3184 | ✗ | tempitemx=x; | |
| 3185 | ✗ | tempitemy=y; | |
| 3186 | ✗ | } | |
| 3187 | |||
| 3188 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3189 | } | ||
| 3190 | |||
| 3191 | ✗ | break; | |
| 3192 | |||
| 3193 | case mfXSWORD: | ||
| 3194 | ✗ | if(!hints) | |
| 3195 | { | ||
| 3196 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,tmpscr->secretcombo[sXSWORD],tmpscr->secretcset[sXSWORD]); | |
| 3197 | ✗ | } | |
| 3198 | else | ||
| 3199 | { | ||
| 3200 | ✗ | tempitem=getItemID(itemsbuf,itype_sword,4); | |
| 3201 | |||
| 3202 | ✗ | if(tempitem<0) break; | |
| 3203 | |||
| 3204 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 3205 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 3206 | { | ||
| 3207 | ✗ | tempitemx=x; | |
| 3208 | ✗ | tempitemy=y; | |
| 3209 | ✗ | } | |
| 3210 | |||
| 3211 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3212 | } | ||
| 3213 | |||
| 3214 | ✗ | break; | |
| 3215 | |||
| 3216 | case mfSWORDBEAM: | ||
| 3217 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!hints) |
| 3218 | { | ||
| 3219 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,tmpscr->secretcombo[sSWORDBEAM],tmpscr->secretcset[sSWORDBEAM]); | |
| 3220 | ✗ | } | |
| 3221 | else | ||
| 3222 | { | ||
| 3223 | 16 | tempitem=getItemID(itemsbuf,itype_sword,1); | |
| 3224 | |||
| 3225 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(tempitem<0) break; |
| 3226 | |||
| 3227 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
|
16 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 3228 |
3/6✓ Branch 0 taken 11 times.
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
16 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 3229 | { | ||
| 3230 | 11 | tempitemx=x; | |
| 3231 | 11 | tempitemy=y; | |
| 3232 | 11 | } | |
| 3233 | |||
| 3234 | 16 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 1); | |
| 3235 | } | ||
| 3236 | |||
| 3237 | 16 | break; | |
| 3238 | |||
| 3239 | case mfWSWORDBEAM: | ||
| 3240 | ✗ | if(!hints) | |
| 3241 | { | ||
| 3242 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,tmpscr->secretcombo[sWSWORDBEAM],tmpscr->secretcset[sWSWORDBEAM]); | |
| 3243 | ✗ | } | |
| 3244 | else | ||
| 3245 | { | ||
| 3246 | ✗ | tempitem=getItemID(itemsbuf,itype_sword,2); | |
| 3247 | |||
| 3248 | ✗ | if(tempitem<0) break; | |
| 3249 | |||
| 3250 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 3251 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 3252 | { | ||
| 3253 | ✗ | tempitemx=x; | |
| 3254 | ✗ | tempitemy=y; | |
| 3255 | ✗ | } | |
| 3256 | |||
| 3257 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 2); | |
| 3258 | } | ||
| 3259 | |||
| 3260 | ✗ | break; | |
| 3261 | |||
| 3262 | case mfMSWORDBEAM: | ||
| 3263 | ✗ | if(!hints) | |
| 3264 | { | ||
| 3265 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,tmpscr->secretcombo[sMSWORDBEAM],tmpscr->secretcset[sMSWORDBEAM]); | |
| 3266 | ✗ | } | |
| 3267 | else | ||
| 3268 | { | ||
| 3269 | ✗ | tempitem=getItemID(itemsbuf,itype_sword,3); | |
| 3270 | |||
| 3271 | ✗ | if(tempitem<0) break; | |
| 3272 | |||
| 3273 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 3274 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 3275 | { | ||
| 3276 | ✗ | tempitemx=x; | |
| 3277 | ✗ | tempitemy=y; | |
| 3278 | ✗ | } | |
| 3279 | |||
| 3280 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 3); | |
| 3281 | } | ||
| 3282 | |||
| 3283 | ✗ | break; | |
| 3284 | |||
| 3285 | case mfXSWORDBEAM: | ||
| 3286 | ✗ | if(!hints) | |
| 3287 | { | ||
| 3288 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,tmpscr->secretcombo[sXSWORDBEAM],tmpscr->secretcset[sXSWORDBEAM]); | |
| 3289 | ✗ | } | |
| 3290 | else | ||
| 3291 | { | ||
| 3292 | ✗ | tempitem=getItemID(itemsbuf,itype_sword,4); | |
| 3293 | |||
| 3294 | ✗ | if(tempitem<0) break; | |
| 3295 | |||
| 3296 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 3297 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 3298 | { | ||
| 3299 | ✗ | tempitemx=x; | |
| 3300 | ✗ | tempitemy=y; | |
| 3301 | ✗ | } | |
| 3302 | |||
| 3303 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 4); | |
| 3304 | } | ||
| 3305 | |||
| 3306 | ✗ | break; | |
| 3307 | |||
| 3308 | case mfHOOKSHOT: | ||
| 3309 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!hints) |
| 3310 | { | ||
| 3311 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,tmpscr->secretcombo[sHOOKSHOT],tmpscr->secretcset[sHOOKSHOT]); | |
| 3312 | ✗ | } | |
| 3313 | else | ||
| 3314 | { | ||
| 3315 | 17 | tempitem=getItemID(itemsbuf,itype_hookshot,1); | |
| 3316 | |||
| 3317 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(tempitem<0) break; |
| 3318 | |||
| 3319 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
|
17 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 3320 |
3/6✓ Branch 0 taken 12 times.
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
17 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 3321 | { | ||
| 3322 | 12 | tempitemx=x; | |
| 3323 | 12 | tempitemy=y; | |
| 3324 | 12 | } | |
| 3325 | |||
| 3326 | 17 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3327 | } | ||
| 3328 | |||
| 3329 | 17 | break; | |
| 3330 | |||
| 3331 | case mfWAND: | ||
| 3332 |
1/2✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
|
35 | if(!hints) |
| 3333 | { | ||
| 3334 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,tmpscr->secretcombo[sWAND],tmpscr->secretcset[sWAND]); | |
| 3335 | ✗ | } | |
| 3336 | else | ||
| 3337 | { | ||
| 3338 | 35 | tempitem=getItemID(itemsbuf,itype_wand,1); | |
| 3339 | |||
| 3340 |
1/2✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
|
35 | if(tempitem<0) break; |
| 3341 | |||
| 3342 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 35 times.
|
35 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 3343 |
3/6✓ Branch 0 taken 28 times.
✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
35 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 3344 | { | ||
| 3345 | 28 | tempitemx=x; | |
| 3346 | 28 | tempitemy=y; | |
| 3347 | 28 | } | |
| 3348 | |||
| 3349 | 35 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3350 | } | ||
| 3351 | |||
| 3352 | 35 | break; | |
| 3353 | |||
| 3354 | case mfHAMMER: | ||
| 3355 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!hints) |
| 3356 | { | ||
| 3357 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,tmpscr->secretcombo[sHAMMER],tmpscr->secretcset[sHAMMER]); | |
| 3358 | ✗ | } | |
| 3359 | else | ||
| 3360 | { | ||
| 3361 | 17 | tempitem=getItemID(itemsbuf,itype_hammer,1); | |
| 3362 | |||
| 3363 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(tempitem<0) break; |
| 3364 | |||
| 3365 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
|
17 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 3366 |
3/6✓ Branch 0 taken 13 times.
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
17 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 3367 | { | ||
| 3368 | 13 | tempitemx=x; | |
| 3369 | 13 | tempitemy=y; | |
| 3370 | 13 | } | |
| 3371 | |||
| 3372 | 17 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3373 | } | ||
| 3374 | |||
| 3375 | 17 | break; | |
| 3376 | |||
| 3377 | case mfARMOS_ITEM: | ||
| 3378 | case mfDIVE_ITEM: | ||
| 3379 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 2602 times.
✓ Branch 2 taken 2602 times.
✗ Branch 3 not taken.
|
2602 | if((!getmapflag() || (tmpscr->flags9&fBELOWRETURN)) && !(itemsbuf[Hero.getLastLensID()].flags & item_flag3)) |
| 3380 | { | ||
| 3381 | 2602 | putitem2(dest,x,y,tmpscr->catchall, lens_hint_item[tmpscr->catchall][0], lens_hint_item[tmpscr->catchall][1], 0); | |
| 3382 | 2602 | } | |
| 3383 | 2602 | break; | |
| 3384 | |||
| 3385 | case 16: | ||
| 3386 | case 17: | ||
| 3387 | case 18: | ||
| 3388 | case 19: | ||
| 3389 | case 20: | ||
| 3390 | case 21: | ||
| 3391 | case 22: | ||
| 3392 | case 23: | ||
| 3393 | case 24: | ||
| 3394 | case 25: | ||
| 3395 | case 26: | ||
| 3396 | case 27: | ||
| 3397 | case 28: | ||
| 3398 | case 29: | ||
| 3399 | case 30: | ||
| 3400 | case 31: | ||
| 3401 |
2/2✓ Branch 0 taken 1008 times.
✓ Branch 1 taken 107890 times.
|
108898 | if(!hints) |
| 3402 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 107890 times.
|
215780 | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2)) |
| 3403 | 107890 | putcombo(dest,x,y,tmpscr->secretcombo[checkflag-16+4],tmpscr->secretcset[checkflag-16+4]); | |
| 3404 | |||
| 3405 | 108898 | break; | |
| 3406 | case mfSECRETSNEXT: | ||
| 3407 | ✗ | if(!hints) | |
| 3408 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2)) | |
| 3409 | ✗ | putcombo(dest,x,y,tmpscr->data[i]+1,tmpscr->cset[i]); | |
| 3410 | |||
| 3411 | ✗ | break; | |
| 3412 | |||
| 3413 | case mfSTRIKE: | ||
| 3414 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 906 times.
|
906 | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2)) |
| 3415 | { | ||
| 3416 | 906 | goto special; | |
| 3417 | } | ||
| 3418 | else | ||
| 3419 | { | ||
| 3420 | ✗ | break; | |
| 3421 | } | ||
| 3422 | |||
| 3423 | 28750 | default: goto special; | |
| 3424 | |||
| 3425 | special: | ||
| 3426 |
8/8✓ Branch 0 taken 14732 times.
✓ Branch 1 taken 14924 times.
✓ Branch 2 taken 528 times.
✓ Branch 3 taken 14204 times.
✓ Branch 4 taken 496 times.
✓ Branch 5 taken 32 times.
✓ Branch 6 taken 6108 times.
✓ Branch 7 taken 8128 times.
|
29656 | if(layer && ((checkflag!=mfRAFT && checkflag!=mfRAFT_BRANCH&& checkflag!=mfRAFT_BOUNCE) ||(itemsbuf[Hero.getLastLensID()].flags & item_flag4))) |
| 3427 | { | ||
| 3428 |
4/8✗ Branch 0 not taken.
✓ Branch 1 taken 6604 times.
✓ Branch 2 taken 4954 times.
✓ Branch 3 taken 1650 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1650 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
6604 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 3429 | { | ||
| 3430 | 4954 | rectfill(dest,x,y,x+15,y+15,WHITE); | |
| 3431 | 4954 | } | |
| 3432 | 6604 | } | |
| 3433 | |||
| 3434 | 29656 | break; | |
| 3435 | } | ||
| 3436 | 7043520 | } | |
| 3437 | 3521760 | } | |
| 3438 | |||
| 3439 |
2/2✓ Branch 0 taken 10005 times.
✓ Branch 1 taken 10005 times.
|
20010 | if(layer) |
| 3440 | { | ||
| 3441 |
2/2✓ Branch 0 taken 9646 times.
✓ Branch 1 taken 359 times.
|
10005 | if(tmpscr->door[0]==dWALK) |
| 3442 | 359 | rectfill(dest, 120, 16+playing_field_offset, 135, 31+playing_field_offset, WHITE); | |
| 3443 | |||
| 3444 |
2/2✓ Branch 0 taken 9582 times.
✓ Branch 1 taken 423 times.
|
10005 | if(tmpscr->door[1]==dWALK) |
| 3445 | 423 | rectfill(dest, 120, 144+playing_field_offset, 135, 159+playing_field_offset, WHITE); | |
| 3446 | |||
| 3447 |
2/2✓ Branch 0 taken 9423 times.
✓ Branch 1 taken 582 times.
|
10005 | if(tmpscr->door[2]==dWALK) |
| 3448 | 582 | rectfill(dest, 16, 80+playing_field_offset, 31, 95+playing_field_offset, WHITE); | |
| 3449 | |||
| 3450 |
2/2✓ Branch 0 taken 9381 times.
✓ Branch 1 taken 624 times.
|
10005 | if(tmpscr->door[3]==dWALK) |
| 3451 | 624 | rectfill(dest, 224, 80+playing_field_offset, 239, 95+playing_field_offset, WHITE); | |
| 3452 | |||
| 3453 |
2/2✓ Branch 0 taken 9962 times.
✓ Branch 1 taken 43 times.
|
10005 | if(tmpscr->door[0]==dBOMB) |
| 3454 | { | ||
| 3455 | 43 | showbombeddoor(dest, 0); | |
| 3456 | 43 | } | |
| 3457 | |||
| 3458 |
2/2✓ Branch 0 taken 9966 times.
✓ Branch 1 taken 39 times.
|
10005 | if(tmpscr->door[1]==dBOMB) |
| 3459 | { | ||
| 3460 | 39 | showbombeddoor(dest, 1); | |
| 3461 | 39 | } | |
| 3462 | |||
| 3463 |
2/2✓ Branch 0 taken 9999 times.
✓ Branch 1 taken 6 times.
|
10005 | if(tmpscr->door[2]==dBOMB) |
| 3464 | { | ||
| 3465 | 6 | showbombeddoor(dest, 2); | |
| 3466 | 6 | } | |
| 3467 | |||
| 3468 |
2/2✓ Branch 0 taken 9968 times.
✓ Branch 1 taken 37 times.
|
10005 | if(tmpscr->door[3]==dBOMB) |
| 3469 | { | ||
| 3470 | 37 | showbombeddoor(dest, 3); | |
| 3471 | 37 | } | |
| 3472 | 10005 | } | |
| 3473 | |||
| 3474 |
2/2✓ Branch 0 taken 17976 times.
✓ Branch 1 taken 2034 times.
|
20010 | if(tmpscr->stairx + tmpscr->stairy) |
| 3475 | { | ||
| 3476 |
2/2✓ Branch 0 taken 911 times.
✓ Branch 1 taken 1123 times.
|
2034 | if(!hints) |
| 3477 | { | ||
| 3478 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1123 times.
|
1123 | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2)) |
| 3479 | 1123 | putcombo(dest,tmpscr->stairx,tmpscr->stairy+playing_field_offset,tmpscr->secretcombo[sSTAIRS],tmpscr->secretcset[sSTAIRS]); | |
| 3480 | 1123 | } | |
| 3481 | else | ||
| 3482 | { | ||
| 3483 |
2/2✓ Branch 0 taken 863 times.
✓ Branch 1 taken 48 times.
|
911 | if(tmpscr->flags&fWHISTLE) |
| 3484 | { | ||
| 3485 | 48 | tempitem=getItemID(itemsbuf,itype_whistle,1); | |
| 3486 | 48 | int32_t tempitemx=-16; | |
| 3487 | 48 | int32_t tempitemy=-16; | |
| 3488 | |||
| 3489 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
|
48 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&(blink_rate/4))) |
| 3490 |
3/6✓ Branch 0 taken 24 times.
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
48 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&(blink_rate/4)))) |
| 3491 | { | ||
| 3492 | 24 | tempitemx=tmpscr->stairx; | |
| 3493 | 24 | tempitemy=tmpscr->stairy+playing_field_offset; | |
| 3494 | 24 | } | |
| 3495 | |||
| 3496 | 48 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3497 | 48 | } | |
| 3498 | } | ||
| 3499 | 2034 | } | |
| 3500 | } | ||
| 3501 | 20010 | } | |
| 3502 | |||
| 3503 | BITMAP *lens_scr_d; // The "d" is for "destructible"! | ||
| 3504 | |||
| 3505 | 9666 | void draw_lens_over() | |
| 3506 | { | ||
| 3507 | // Oh, what the heck. | ||
| 3508 | static BITMAP *lens_scr = NULL; | ||
| 3509 | static int32_t last_width = -1; | ||
| 3510 | 9666 | int32_t width = itemsbuf[current_item_id(itype_lens,true)].misc1; | |
| 3511 | |||
| 3512 | // Only redraw the circle if the size has changed | ||
| 3513 |
2/2✓ Branch 0 taken 9647 times.
✓ Branch 1 taken 19 times.
|
9666 | if(width != last_width) |
| 3514 | { | ||
| 3515 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 2 times.
|
19 | if(lens_scr == NULL) |
| 3516 | { | ||
| 3517 | 17 | lens_scr = create_bitmap_ex(8,2*288,2*(240-playing_field_offset)); | |
| 3518 | 17 | } | |
| 3519 | |||
| 3520 | 19 | clear_to_color(lens_scr, BLACK); | |
| 3521 | 19 | circlefill(lens_scr, 288, 240-playing_field_offset, width, 0); | |
| 3522 | 19 | circle(lens_scr, 288, 240-playing_field_offset, width+2, 0); | |
| 3523 | 19 | circle(lens_scr, 288, 240-playing_field_offset, width+5, 0); | |
| 3524 | 19 | last_width=width; | |
| 3525 | 19 | } | |
| 3526 | |||
| 3527 | 9666 | masked_blit(lens_scr, framebuf, 288-(HeroX()+8), 240-playing_field_offset-(HeroY()+8), 0, playing_field_offset, 256, 168); | |
| 3528 | 9666 | do_primitives(framebuf, SPLAYER_LENS_OVER, tmpscr, 0, playing_field_offset); | |
| 3529 | 9666 | } | |
| 3530 | |||
| 3531 | //---------------------------------------------------------------- | ||
| 3532 | |||
| 3533 | 31797 | void draw_wavy(BITMAP *source, BITMAP *target, int32_t amplitude, bool interpol) | |
| 3534 | { | ||
| 3535 | //recreating a big bitmap every frame is highly sluggish. | ||
| 3536 |
4/6✓ Branch 0 taken 5 times.
✓ Branch 1 taken 31792 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
31797 | static BITMAP *wavebuf = create_bitmap_ex(8,288,240-original_playing_field_offset); |
| 3537 | 31797 | clear_to_color(wavebuf, BLACK); | |
| 3538 | 31797 | blit(source,wavebuf,0,original_playing_field_offset,16,0,256,224-original_playing_field_offset); | |
| 3539 | |||
| 3540 | int32_t ofs; | ||
| 3541 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 31797 times.
|
31797 | amplitude = zc_min(2048,amplitude); // some arbitrary limit to prevent crashing |
| 3542 |
4/6✓ Branch 0 taken 31797 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 31797 times.
✓ Branch 4 taken 494 times.
✓ Branch 5 taken 31303 times.
|
31797 | if(flash_reduction_enabled() && !get_qr(qr_WAVY_NO_EPILEPSY)) amplitude = zc_min(16,amplitude); |
| 3543 | 31797 | int32_t amp2=168; | |
| 3544 |
2/4✓ Branch 0 taken 31797 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 31797 times.
|
31797 | if(flash_reduction_enabled() && !get_qr(qr_WAVY_NO_EPILEPSY_2)) amp2*=2; |
| 3545 | 31797 | int32_t i=frame%amp2; | |
| 3546 | |||
| 3547 |
2/2✓ Branch 0 taken 5341896 times.
✓ Branch 1 taken 31797 times.
|
5373693 | for(int32_t j=0; j<168; j++) |
| 3548 | { | ||
| 3549 |
3/4✓ Branch 0 taken 2670948 times.
✓ Branch 1 taken 2670948 times.
✓ Branch 2 taken 2670948 times.
✗ Branch 3 not taken.
|
5341896 | if(j&1 && interpol) |
| 3550 | { | ||
| 3551 | // Add 288*2048 to ensure it's never negative. It'll get modded out. | ||
| 3552 | ✗ | ofs=288*2048+int32_t(zc::math::Sin((double(i+j)*2*PI/amp2))*amplitude); | |
| 3553 | ✗ | } | |
| 3554 | else | ||
| 3555 | { | ||
| 3556 | 5341896 | ofs=288*2048-int32_t(zc::math::Sin((double(i+j)*2*PI/amp2))*amplitude); | |
| 3557 | } | ||
| 3558 | |||
| 3559 |
1/2✓ Branch 0 taken 5341896 times.
✗ Branch 1 not taken.
|
5341896 | if(ofs) |
| 3560 | { | ||
| 3561 |
2/2✓ Branch 0 taken 1367525376 times.
✓ Branch 1 taken 5341896 times.
|
1372867272 | for(int32_t k=0; k<256; k++) |
| 3562 | { | ||
| 3563 | 1367525376 | target->line[j+original_playing_field_offset][k]=wavebuf->line[j][(k+ofs+16)%288]; | |
| 3564 | 1367525376 | } | |
| 3565 | 5341896 | } | |
| 3566 | 5341896 | } | |
| 3567 | 31797 | } | |
| 3568 | |||
| 3569 | 28224 | void draw_fuzzy(int32_t fuzz) | |
| 3570 | // draws from right half of scrollbuf to framebuf | ||
| 3571 | { | ||
| 3572 | int32_t firstx, firsty, xstep, ystep, i, y, dx, dy; | ||
| 3573 | byte *start, *si, *di; | ||
| 3574 | |||
| 3575 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 28224 times.
|
28224 | if(fuzz<1) |
| 3576 | ✗ | fuzz = 1; | |
| 3577 | |||
| 3578 | 28224 | xstep = 128%fuzz; | |
| 3579 | |||
| 3580 |
2/2✓ Branch 0 taken 5880 times.
✓ Branch 1 taken 22344 times.
|
28224 | if(xstep > 0) |
| 3581 | 22344 | xstep = fuzz-xstep; | |
| 3582 | |||
| 3583 | 28224 | ystep = 112%fuzz; | |
| 3584 | |||
| 3585 |
2/2✓ Branch 0 taken 8232 times.
✓ Branch 1 taken 19992 times.
|
28224 | if(ystep > 0) |
| 3586 | 19992 | ystep = fuzz-ystep; | |
| 3587 | |||
| 3588 | 28224 | firsty = 1; | |
| 3589 | |||
| 3590 |
2/2✓ Branch 0 taken 28224 times.
✓ Branch 1 taken 1018416 times.
|
1046640 | for(y=0; y<224;) |
| 3591 | { | ||
| 3592 | 1018416 | start = &(scrollbuf->line[y][256]); | |
| 3593 | |||
| 3594 |
4/4✓ Branch 0 taken 1004304 times.
✓ Branch 1 taken 6336288 times.
✓ Branch 2 taken 6322176 times.
✓ Branch 3 taken 1018416 times.
|
7340592 | for(dy=0; dy<ystep && dy+y<224; dy++) |
| 3595 | { | ||
| 3596 | 6322176 | si = start; | |
| 3597 | 6322176 | di = &(framebuf->line[y+dy][0]); | |
| 3598 | 6322176 | i = xstep; | |
| 3599 | 6322176 | firstx = 1; | |
| 3600 | |||
| 3601 |
2/2✓ Branch 0 taken 1618477056 times.
✓ Branch 1 taken 6322176 times.
|
1624799232 | for(dx=0; dx<256; dx++) |
| 3602 | { | ||
| 3603 | 1618477056 | *(di++) = *si; | |
| 3604 | |||
| 3605 |
2/2✓ Branch 0 taken 1363746048 times.
✓ Branch 1 taken 254731008 times.
|
1618477056 | if(++i >= fuzz) |
| 3606 | { | ||
| 3607 |
2/2✓ Branch 0 taken 248408832 times.
✓ Branch 1 taken 6322176 times.
|
254731008 | if(!firstx) |
| 3608 | 248408832 | si += fuzz; | |
| 3609 | else | ||
| 3610 | { | ||
| 3611 | 6322176 | si += fuzz-xstep; | |
| 3612 | 6322176 | firstx = 0; | |
| 3613 | } | ||
| 3614 | |||
| 3615 | 254731008 | i = 0; | |
| 3616 | 254731008 | } | |
| 3617 | 1618477056 | } | |
| 3618 | 6322176 | } | |
| 3619 | |||
| 3620 |
2/2✓ Branch 0 taken 990192 times.
✓ Branch 1 taken 28224 times.
|
1018416 | if(!firsty) |
| 3621 | 990192 | y += fuzz; | |
| 3622 | else | ||
| 3623 | { | ||
| 3624 | 28224 | y += ystep; | |
| 3625 | 28224 | ystep = fuzz; | |
| 3626 | 28224 | firsty = 0; | |
| 3627 | } | ||
| 3628 | } | ||
| 3629 | 28224 | } | |
| 3630 | |||
| 3631 | 18326659 | void updatescr(bool allowwavy) | |
| 3632 | { | ||
| 3633 |
4/6✓ Branch 0 taken 266 times.
✓ Branch 1 taken 18326393 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 266 times.
✓ Branch 4 taken 266 times.
✗ Branch 5 not taken.
|
18326659 | static BITMAP *wavybuf = create_bitmap_ex(8,256,224); |
| 3634 |
4/6✓ Branch 0 taken 266 times.
✓ Branch 1 taken 18326393 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 266 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 266 times.
|
18326659 | static BITMAP *panorama = create_bitmap_ex(8,256,224); |
| 3635 | |||
| 3636 |
2/2✓ Branch 0 taken 18299354 times.
✓ Branch 1 taken 27305 times.
|
18326659 | if(toogam) |
| 3637 | { | ||
| 3638 | 27305 | textout_ex(framebuf,font,"no walls",8,216,1,-1); | |
| 3639 | 27305 | } | |
| 3640 | |||
| 3641 |
1/2✓ Branch 0 taken 18326659 times.
✗ Branch 1 not taken.
|
18326659 | if(Showpal) |
| 3642 | ✗ | dump_pal(framebuf); | |
| 3643 | |||
| 3644 |
2/2✓ Branch 0 taken 17813256 times.
✓ Branch 1 taken 513403 times.
|
18326659 | if(!Playing) |
| 3645 | 513403 | black_opening_count=0; | |
| 3646 | |||
| 3647 |
2/2✓ Branch 0 taken 18162236 times.
✓ Branch 1 taken 164423 times.
|
18326659 | if(black_opening_count<0) //shape is opening up |
| 3648 | { | ||
| 3649 | 164423 | black_opening(framebuf,black_opening_x,black_opening_y,(66+black_opening_count),66); | |
| 3650 | |||
| 3651 |
2/4✓ Branch 0 taken 164423 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 164423 times.
|
164423 | if(Advance||(!Paused)) |
| 3652 | { | ||
| 3653 | 164423 | ++black_opening_count; | |
| 3654 | 164423 | } | |
| 3655 | 164423 | } | |
| 3656 |
2/2✓ Branch 0 taken 18114254 times.
✓ Branch 1 taken 47982 times.
|
18162236 | else if(black_opening_count>0) //shape is closing |
| 3657 | { | ||
| 3658 | 47982 | black_opening(framebuf,black_opening_x,black_opening_y,black_opening_count,66); | |
| 3659 | |||
| 3660 |
2/4✓ Branch 0 taken 47982 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 47982 times.
|
47982 | if(Advance||(!Paused)) |
| 3661 | { | ||
| 3662 | 47982 | --black_opening_count; | |
| 3663 | 47982 | } | |
| 3664 | 47982 | } | |
| 3665 | |||
| 3666 |
3/4✓ Branch 0 taken 18117472 times.
✓ Branch 1 taken 209187 times.
✓ Branch 2 taken 18117472 times.
✗ Branch 3 not taken.
|
18326659 | if(black_opening_count==0&&black_opening_shape==bosFADEBLACK) |
| 3667 | { | ||
| 3668 | ✗ | black_opening_shape = bosCIRCLE; | |
| 3669 | ✗ | memcpy(RAMpal, tempblackpal, PAL_SIZE*sizeof(RGB)); | |
| 3670 | ✗ | refreshTints(); | |
| 3671 | ✗ | refreshpal=true; | |
| 3672 | ✗ | } | |
| 3673 | |||
| 3674 |
2/2✓ Branch 0 taken 17697857 times.
✓ Branch 1 taken 628802 times.
|
18326659 | if(refreshpal) |
| 3675 | { | ||
| 3676 | 628802 | refreshpal=false; | |
| 3677 | 628802 | RAMpal[253] = _RGB(0,0,0); | |
| 3678 | 628802 | RAMpal[254] = _RGB(255,255,255); | |
| 3679 | 628802 | hw_palette = &RAMpal; | |
| 3680 | 628802 | update_hw_pal = true; | |
| 3681 | |||
| 3682 | // Creating rgb_table and trans_table is pretty expensive, so try not to redo the same work | ||
| 3683 | // within a short period of time by using a cache. | ||
| 3684 | typedef std::array<uint32_t, PAL_SIZE> pal_table_cache_key; | ||
| 3685 | struct pal_table_cache_entry { | ||
| 3686 | RGB_MAP rgb_table; | ||
| 3687 | COLOR_MAP trans_table; | ||
| 3688 | }; | ||
| 3689 |
3/4✓ Branch 0 taken 266 times.
✓ Branch 1 taken 628536 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 266 times.
|
628802 | static std::map<pal_table_cache_key, pal_table_cache_entry> pal_table_cache; |
| 3690 | |||
| 3691 | static constexpr int pal_table_cache_max_memory_mb = 10; | ||
| 3692 | static constexpr int pal_table_cache_max_size = pal_table_cache_max_memory_mb / ((double)sizeof(pal_table_cache_entry) / 1024 / 1024); | ||
| 3693 |
2/2✓ Branch 0 taken 628638 times.
✓ Branch 1 taken 164 times.
|
628802 | if (pal_table_cache.size() > pal_table_cache_max_size) |
| 3694 | 164 | pal_table_cache.clear(); | |
| 3695 | |||
| 3696 | pal_table_cache_key key; | ||
| 3697 |
2/2✓ Branch 0 taken 160973312 times.
✓ Branch 1 taken 628802 times.
|
161602114 | for (int i = 0; i < PAL_SIZE; i++) |
| 3698 | 160973312 | key[i] = RAMpal[i].r + (RAMpal[i].g << 8) + (RAMpal[i].b << 16); | |
| 3699 | 628802 | auto cache_it = pal_table_cache.find(key); | |
| 3700 |
2/2✓ Branch 0 taken 24944 times.
✓ Branch 1 taken 603858 times.
|
628802 | if (cache_it == pal_table_cache.end()) |
| 3701 | { | ||
| 3702 | 24944 | create_rgb_table(&rgb_table, RAMpal, NULL); | |
| 3703 | 24944 | create_zc_trans_table(&trans_table, RAMpal, 128, 128, 128); | |
| 3704 | 24944 | pal_table_cache[key] = {rgb_table, trans_table}; | |
| 3705 | 24944 | trans_table2 = trans_table; | |
| 3706 | 24944 | } | |
| 3707 | else | ||
| 3708 | { | ||
| 3709 | 603858 | rgb_table = cache_it->second.rgb_table; | |
| 3710 | 603858 | trans_table = cache_it->second.trans_table; | |
| 3711 | 603858 | trans_table2 = cache_it->second.trans_table; | |
| 3712 | } | ||
| 3713 | |||
| 3714 |
2/2✓ Branch 0 taken 160973312 times.
✓ Branch 1 taken 628802 times.
|
161602114 | for(int32_t q=0; q<PAL_SIZE; q++) |
| 3715 | { | ||
| 3716 | 160973312 | trans_table2.data[0][q] = q; | |
| 3717 | 160973312 | trans_table2.data[q][q] = q; | |
| 3718 | 160973312 | } | |
| 3719 | 628802 | } | |
| 3720 | |||
| 3721 | 18326659 | bool clearwavy = (wavy <= 0); | |
| 3722 | |||
| 3723 |
2/2✓ Branch 0 taken 8341 times.
✓ Branch 1 taken 18318318 times.
|
18326659 | if(wavy <= 0) |
| 3724 | { | ||
| 3725 | // So far one thing can alter wavy apart from scripts: Wavy DMaps. | ||
| 3726 | 18318318 | wavy = (DMaps[currdmap].flags&dmfWAVY ? 4 : 0); | |
| 3727 | 18318318 | } | |
| 3728 | |||
| 3729 | 18326659 | blit(framebuf, wavybuf, 0, 0, 0, 0, 256, 224); | |
| 3730 | |||
| 3731 |
6/6✓ Branch 0 taken 32047 times.
✓ Branch 1 taken 18294612 times.
✓ Branch 2 taken 31925 times.
✓ Branch 3 taken 122 times.
✓ Branch 4 taken 128 times.
✓ Branch 5 taken 31797 times.
|
18326659 | if(wavy && Playing && allowwavy) |
| 3732 | { | ||
| 3733 | 31797 | draw_wavy(framebuf, wavybuf, wavy,false); | |
| 3734 | 31797 | } | |
| 3735 | |||
| 3736 |
2/2✓ Branch 0 taken 18318318 times.
✓ Branch 1 taken 8341 times.
|
18326659 | if(clearwavy) |
| 3737 | 18318318 | wavy = 0; // Wavy was set by a DMap flag. Clear it. | |
| 3738 |
2/4✓ Branch 0 taken 8341 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 8341 times.
|
8341 | else if(Playing && !Paused) |
| 3739 | 8341 | wavy--; // Wavy was set by a script. Decrement it. | |
| 3740 | |||
| 3741 |
5/6✓ Branch 0 taken 17813256 times.
✓ Branch 1 taken 513403 times.
✓ Branch 2 taken 664395 times.
✓ Branch 3 taken 17148861 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 664395 times.
|
18326659 | if(Playing && msgpos && !screenscrolling) |
| 3742 | { | ||
| 3743 |
1/2✓ Branch 0 taken 664395 times.
✗ Branch 1 not taken.
|
664395 | if(!(msg_bg_display_buf->clip)) |
| 3744 | 664395 | blit_msgstr_bg(framebuf,0,0,0,playing_field_offset,256,168); | |
| 3745 |
1/2✓ Branch 0 taken 664395 times.
✗ Branch 1 not taken.
|
664395 | if(!(msg_portrait_display_buf->clip)) |
| 3746 | 664395 | blit_msgstr_prt(framebuf,0,0,0,playing_field_offset,256,168); | |
| 3747 |
1/2✓ Branch 0 taken 664395 times.
✗ Branch 1 not taken.
|
664395 | if(!(msg_txt_display_buf->clip)) |
| 3748 | 664395 | blit_msgstr_fg(framebuf,0,0,0,playing_field_offset,256,168); | |
| 3749 | 664395 | } | |
| 3750 | |||
| 3751 |
2/2✓ Branch 0 taken 18140150 times.
✓ Branch 1 taken 186509 times.
|
18326659 | bool nosubscr = (tmpscr->flags3&fNOSUBSCR && !(tmpscr->flags3&fNOSUBSCROFFSET)); |
| 3752 | |||
| 3753 |
2/2✓ Branch 0 taken 18145423 times.
✓ Branch 1 taken 181236 times.
|
18326659 | if(nosubscr) |
| 3754 | { | ||
| 3755 | 181236 | rectfill(panorama,0,0,255,passive_subscreen_height/2,0); | |
| 3756 | 181236 | rectfill(panorama,0,168+passive_subscreen_height/2,255,168+passive_subscreen_height-1,0); | |
| 3757 | 181236 | blit(wavybuf,panorama,0,playing_field_offset,0,passive_subscreen_height/2,256,224-passive_subscreen_height); | |
| 3758 | 181236 | } | |
| 3759 | |||
| 3760 | //TODO: Optimize blit 'overcalls' -Gleeok | ||
| 3761 |
2/2✓ Branch 0 taken 181236 times.
✓ Branch 1 taken 18145423 times.
|
18326659 | BITMAP *source = nosubscr ? panorama : wavybuf; |
| 3762 | 18326659 | blit(source,framebuf,0,0,0,0,256,224); | |
| 3763 | |||
| 3764 | 18326659 | update_hw_screen(); | |
| 3765 | 18326659 | } | |
| 3766 | |||
| 3767 | //---------------------------------------------------------------- | ||
| 3768 | |||
| 3769 | static PALETTE syspal; | ||
| 3770 | ✗ | int32_t onGUISnapshot() | |
| 3771 | { | ||
| 3772 | char buf[200]; | ||
| 3773 | ✗ | int32_t num=0; | |
| 3774 | ✗ | do | |
| 3775 | { | ||
| 3776 | ✗ | sprintf(buf, "%szc_screen%05d.%s", get_snap_str(), ++num, snapshotformat_str[SnapshotFormat][1]); | |
| 3777 | ✗ | } | |
| 3778 | ✗ | while(num<99999 && exists(buf)); | |
| 3779 | |||
| 3780 | ✗ | if (!al_save_bitmap(buf, al_get_backbuffer(all_get_display()))) | |
| 3781 | ✗ | InfoDialog("Error", "Failed to save snapshot").show(); | |
| 3782 | |||
| 3783 | ✗ | return D_O_K; | |
| 3784 | ✗ | } | |
| 3785 | |||
| 3786 | ✗ | int32_t onNonGUISnapshot() | |
| 3787 | { | ||
| 3788 | PALETTE temppal; | ||
| 3789 | ✗ | get_palette(temppal); | |
| 3790 | ✗ | bool realpal=(zc_getkey(KEY_ZC_LCONTROL, true) || zc_getkey(KEY_ZC_RCONTROL, true)); | |
| 3791 | |||
| 3792 | char buf[200]; | ||
| 3793 | ✗ | int32_t num=0; | |
| 3794 | |||
| 3795 | ✗ | do | |
| 3796 | { | ||
| 3797 | ✗ | sprintf(buf, "%szc_screen%05d.%s", get_snap_str(), ++num, snapshotformat_str[SnapshotFormat][1]); | |
| 3798 | ✗ | } | |
| 3799 | ✗ | while(num<99999 && exists(buf)); | |
| 3800 | |||
| 3801 | ✗ | if ((tmpscr->flags3&fNOSUBSCR && !(tmpscr->flags3&fNOSUBSCROFFSET)) && !(key[KEY_ALT])) | |
| 3802 | { | ||
| 3803 | ✗ | BITMAP *b = create_bitmap_ex(8,256,168); | |
| 3804 | ✗ | clear_to_color(b,0); | |
| 3805 | ✗ | blit(framebuf,b,0,passive_subscreen_height/2,0,0,256,168); | |
| 3806 | ✗ | alleg4_save_bitmap(b, SnapshotScale, buf, realpal ? temppal : RAMpal); | |
| 3807 | ✗ | destroy_bitmap(b); | |
| 3808 | ✗ | } | |
| 3809 | else | ||
| 3810 | { | ||
| 3811 | ✗ | alleg4_save_bitmap(framebuf, SnapshotScale, buf, realpal?temppal:RAMpal); | |
| 3812 | } | ||
| 3813 | |||
| 3814 | ✗ | return D_O_K; | |
| 3815 | } | ||
| 3816 | |||
| 3817 | ✗ | int32_t onSnapshot() | |
| 3818 | { | ||
| 3819 | ✗ | if(zc_getkey(KEY_LSHIFT, true)||zc_getkey(KEY_RSHIFT, true)) | |
| 3820 | { | ||
| 3821 | ✗ | onGUISnapshot(); | |
| 3822 | ✗ | } | |
| 3823 | else | ||
| 3824 | { | ||
| 3825 | ✗ | onNonGUISnapshot(); | |
| 3826 | } | ||
| 3827 | |||
| 3828 | ✗ | return D_O_K; | |
| 3829 | } | ||
| 3830 | |||
| 3831 | ✗ | int32_t onSaveMapPic() | |
| 3832 | { | ||
| 3833 | ✗ | int32_t mapres2 = 0; | |
| 3834 | char buf[200]; | ||
| 3835 | ✗ | int32_t num=0; | |
| 3836 | ✗ | mapscr tmpscr_b[2]; | |
| 3837 | ✗ | mapscr tmpscr_c[6]; | |
| 3838 | ✗ | BITMAP* _screen_draw_buffer = NULL; | |
| 3839 | ✗ | _screen_draw_buffer = create_bitmap_ex(8,256,224); | |
| 3840 | ✗ | set_clip_state(_screen_draw_buffer,1); | |
| 3841 | |||
| 3842 | ✗ | for(int32_t i=0; i<6; ++i) | |
| 3843 | { | ||
| 3844 | ✗ | tmpscr_c[i] = tmpscr2[i]; | |
| 3845 | ✗ | tmpscr2[i].zero_memory(); | |
| 3846 | |||
| 3847 | ✗ | if(i>=2) | |
| 3848 | { | ||
| 3849 | ✗ | continue; | |
| 3850 | } | ||
| 3851 | |||
| 3852 | ✗ | tmpscr_b[i] = tmpscr[i]; | |
| 3853 | ✗ | tmpscr[i].zero_memory(); | |
| 3854 | ✗ | } | |
| 3855 | |||
| 3856 | ✗ | do | |
| 3857 | { | ||
| 3858 | ✗ | sprintf(buf, "%szc_screen%05d.png", get_snap_str(), ++num); | |
| 3859 | ✗ | } | |
| 3860 | ✗ | while(num<99999 && exists(buf)); | |
| 3861 | |||
| 3862 | ✗ | BITMAP* mappic = NULL; | |
| 3863 | |||
| 3864 | |||
| 3865 | ✗ | bool done=false, redraw=true; | |
| 3866 | |||
| 3867 | ✗ | mappic = create_bitmap_ex(8,(256*16)>>mapres,(176*8)>>mapres); | |
| 3868 | |||
| 3869 | ✗ | if(!mappic) | |
| 3870 | { | ||
| 3871 | ✗ | enter_sys_pal(); | |
| 3872 | ✗ | jwin_alert("View Map","Not enough memory.",NULL,NULL,"OK",NULL,13,27,get_zc_font(font_lfont)); | |
| 3873 | ✗ | exit_sys_pal(); | |
| 3874 | ✗ | return D_O_K;; | |
| 3875 | } | ||
| 3876 | |||
| 3877 | // draw the map | ||
| 3878 | ✗ | set_clip_rect(_screen_draw_buffer, 0, 0, _screen_draw_buffer->w, _screen_draw_buffer->h); | |
| 3879 | |||
| 3880 | ✗ | for(int32_t y=0; y<8; y++) | |
| 3881 | { | ||
| 3882 | ✗ | for(int32_t x=0; x<16; x++) | |
| 3883 | { | ||
| 3884 | ✗ | if(!displayOnMap(x, y)) | |
| 3885 | { | ||
| 3886 | ✗ | rectfill(_screen_draw_buffer, 0, 0, 255, 223, WHITE); | |
| 3887 | ✗ | } | |
| 3888 | else | ||
| 3889 | { | ||
| 3890 | ✗ | int32_t s = (y<<4) + x; | |
| 3891 | ✗ | loadscr2(1,s,-1); | |
| 3892 | |||
| 3893 | ✗ | for(int32_t i=0; i<6; i++) | |
| 3894 | { | ||
| 3895 | ✗ | if(tmpscr[1].layermap[i]<=0) | |
| 3896 | ✗ | continue; | |
| 3897 | |||
| 3898 | ✗ | tmpscr2[i]=TheMaps[(tmpscr[1].layermap[i]-1)*MAPSCRS+tmpscr[1].layerscreen[i]]; | |
| 3899 | ✗ | } | |
| 3900 | |||
| 3901 | ✗ | if(XOR((tmpscr+1)->flags7&fLAYER2BG, DMaps[currdmap].flags&dmfLAYER2BG)) do_layer(_screen_draw_buffer, 0, 2, tmpscr+1, -256, playing_field_offset, 2); | |
| 3902 | |||
| 3903 | ✗ | if(XOR((tmpscr+1)->flags7&fLAYER3BG, DMaps[currdmap].flags&dmfLAYER3BG)) do_layer(_screen_draw_buffer, 0, 3, tmpscr+1, -256, playing_field_offset, 2); | |
| 3904 | |||
| 3905 | ✗ | if(lenscheck(tmpscr+1,0)) putscr(_screen_draw_buffer,256,0,tmpscr+1); | |
| 3906 | ✗ | do_layer(_screen_draw_buffer, 0, 1, tmpscr+1, -256, playing_field_offset, 2); | |
| 3907 | |||
| 3908 | ✗ | if(!XOR((tmpscr+1)->flags7&fLAYER2BG, DMaps[currdmap].flags&dmfLAYER2BG)) do_layer(_screen_draw_buffer, 0, 2, tmpscr+1, -256, playing_field_offset, 2); | |
| 3909 | |||
| 3910 | ✗ | putscrdoors(_screen_draw_buffer,256,0,tmpscr+1); | |
| 3911 | ✗ | if(get_qr(qr_PUSHBLOCK_SPRITE_LAYER)) | |
| 3912 | { | ||
| 3913 | ✗ | do_layer(_screen_draw_buffer, -2, 0, tmpscr+1, -256, playing_field_offset, 2); | |
| 3914 | ✗ | if(get_qr(qr_PUSHBLOCK_LAYER_1_2)) | |
| 3915 | { | ||
| 3916 | ✗ | do_layer(_screen_draw_buffer, -2, 1, tmpscr+1, -256, playing_field_offset, 2); | |
| 3917 | ✗ | do_layer(_screen_draw_buffer, -2, 2, tmpscr+1, -256, playing_field_offset, 2); | |
| 3918 | ✗ | } | |
| 3919 | ✗ | } | |
| 3920 | ✗ | do_layer(_screen_draw_buffer, -3, 0, tmpscr+1, -256, playing_field_offset, 2); // Freeform combos! | |
| 3921 | |||
| 3922 | ✗ | if(!XOR((tmpscr+1)->flags7&fLAYER3BG, DMaps[currdmap].flags&dmfLAYER3BG)) do_layer(_screen_draw_buffer, 0, 3, tmpscr+1, -256, playing_field_offset, 2); | |
| 3923 | |||
| 3924 | ✗ | do_layer(_screen_draw_buffer, 0, 4, tmpscr+1, -256, playing_field_offset, 2); | |
| 3925 | ✗ | do_layer(_screen_draw_buffer, -1, 0, tmpscr+1, -256, playing_field_offset, 2); | |
| 3926 | ✗ | if(get_qr(qr_OVERHEAD_COMBOS_L1_L2)) | |
| 3927 | { | ||
| 3928 | ✗ | do_layer(_screen_draw_buffer, -1, 1, tmpscr+1, -256, playing_field_offset, 2); | |
| 3929 | ✗ | do_layer(_screen_draw_buffer, -1, 2, tmpscr+1, -256, playing_field_offset, 2); | |
| 3930 | ✗ | } | |
| 3931 | ✗ | do_layer(_screen_draw_buffer, 0, 5, tmpscr+1, -256, playing_field_offset, 2); | |
| 3932 | ✗ | do_layer(_screen_draw_buffer, 0, 6, tmpscr+1, -256, playing_field_offset, 2); | |
| 3933 | |||
| 3934 | } | ||
| 3935 | |||
| 3936 | ✗ | stretch_blit(_screen_draw_buffer, mappic, 256, 0, 256, 176, x<<(8-mapres), (y*176)>>mapres, 256>>mapres, 176>>mapres); | |
| 3937 | ✗ | } | |
| 3938 | ✗ | } | |
| 3939 | |||
| 3940 | ✗ | for(int32_t i=0; i<6; ++i) | |
| 3941 | { | ||
| 3942 | ✗ | tmpscr2[i]=tmpscr_c[i]; | |
| 3943 | |||
| 3944 | ✗ | if(i>=2) | |
| 3945 | { | ||
| 3946 | ✗ | continue; | |
| 3947 | } | ||
| 3948 | |||
| 3949 | ✗ | tmpscr[i]=tmpscr_b[i]; | |
| 3950 | ✗ | } | |
| 3951 | |||
| 3952 | ✗ | save_bitmap(buf,mappic,RAMpal); | |
| 3953 | ✗ | destroy_bitmap(mappic); | |
| 3954 | ✗ | destroy_bitmap(_screen_draw_buffer); | |
| 3955 | ✗ | return D_O_K; | |
| 3956 | ✗ | } | |
| 3957 | |||
| 3958 | 61 | void f_Quit(int32_t type) | |
| 3959 | { | ||
| 3960 |
2/4✓ Branch 0 taken 61 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 61 times.
✗ Branch 3 not taken.
|
61 | if(type==qQUIT && !Playing) |
| 3961 | ✗ | return; | |
| 3962 | |||
| 3963 | 61 | bool from_menu = is_sys_pal; | |
| 3964 | |||
| 3965 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 61 times.
|
61 | if(!from_menu) |
| 3966 | { | ||
| 3967 | 61 | music_pause(); | |
| 3968 | 61 | pause_all_sfx(); | |
| 3969 | 61 | sys_mouse(); | |
| 3970 | 61 | } | |
| 3971 | 61 | enter_sys_pal(); | |
| 3972 | 61 | clear_keybuf(); | |
| 3973 | |||
| 3974 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 13 times.
|
61 | if (replay_version_check(0, 10)) |
| 3975 | 13 | replay_poll(); | |
| 3976 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 61 times.
|
61 | if (replay_is_replaying()) |
| 3977 | 61 | replay_peek_quit(); | |
| 3978 | |||
| 3979 |
1/2✓ Branch 0 taken 61 times.
✗ Branch 1 not taken.
|
61 | if (!replay_is_replaying()) |
| 3980 | ✗ | switch(type) | |
| 3981 | { | ||
| 3982 | case qQUIT: | ||
| 3983 | ✗ | onQuit(); | |
| 3984 | ✗ | break; | |
| 3985 | |||
| 3986 | case qRESET: | ||
| 3987 | ✗ | onReset(); | |
| 3988 | ✗ | break; | |
| 3989 | |||
| 3990 | case qEXIT: | ||
| 3991 | ✗ | onExit(); | |
| 3992 | ✗ | break; | |
| 3993 | ✗ | } | |
| 3994 | |||
| 3995 |
1/2✓ Branch 0 taken 61 times.
✗ Branch 1 not taken.
|
61 | if(Quit) |
| 3996 | { | ||
| 3997 | 61 | kill_sfx(); | |
| 3998 | 61 | music_stop(); | |
| 3999 | 61 | exit_sys_pal(); | |
| 4000 | 61 | update_hw_screen(); | |
| 4001 | 61 | } | |
| 4002 | else | ||
| 4003 | { | ||
| 4004 | ✗ | exit_sys_pal(); | |
| 4005 | ✗ | if(!from_menu) | |
| 4006 | { | ||
| 4007 | ✗ | music_resume(); | |
| 4008 | ✗ | resume_all_sfx(); | |
| 4009 | ✗ | } | |
| 4010 | } | ||
| 4011 | |||
| 4012 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 61 times.
|
61 | if(!from_menu) |
| 4013 | 61 | game_mouse(); | |
| 4014 | 61 | eat_buttons(); | |
| 4015 | |||
| 4016 | 61 | zc_readrawkey(KEY_ESC); | |
| 4017 | |||
| 4018 | 61 | zc_readrawkey(KEY_ENTER); | |
| 4019 | 61 | } | |
| 4020 | |||
| 4021 | //---------------------------------------------------------------- | ||
| 4022 | |||
| 4023 | ✗ | int32_t onNoWalls() | |
| 4024 | { | ||
| 4025 | ✗ | cheats_enqueue(Cheat::Walls); | |
| 4026 | ✗ | return D_O_K; | |
| 4027 | ✗ | } | |
| 4028 | |||
| 4029 | ✗ | int32_t onIgnoreSideview() | |
| 4030 | { | ||
| 4031 | ✗ | cheats_enqueue(Cheat::IgnoreSideView); | |
| 4032 | ✗ | return D_O_K; | |
| 4033 | ✗ | } | |
| 4034 | |||
| 4035 | 18325316 | int32_t input_idle(bool checkmouse) | |
| 4036 | { | ||
| 4037 | static int32_t mx, my, mz, mb; | ||
| 4038 | |||
| 4039 |
4/6✓ Branch 0 taken 18325316 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4908815 times.
✓ Branch 3 taken 13416501 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 4908815 times.
|
23234131 | if(keypressed() || zc_key_pressed() || |
| 4040 |
4/8✓ Branch 0 taken 4908815 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4908815 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4908815 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 4908815 times.
✗ Branch 7 not taken.
|
4908815 | (checkmouse && (mx != mouse_x || my != mouse_y || mz != mouse_z || mb != mouse_b))) |
| 4041 | { | ||
| 4042 | 13416501 | idle_count = 0; | |
| 4043 | |||
| 4044 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13416501 times.
|
13416501 | if(active_count < MAX_ACTIVE) |
| 4045 | { | ||
| 4046 | 13416501 | ++active_count; | |
| 4047 | 13416501 | } | |
| 4048 | 13416501 | } | |
| 4049 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4908815 times.
|
4908815 | else if(idle_count < MAX_IDLE) |
| 4050 | { | ||
| 4051 | 4908815 | ++idle_count; | |
| 4052 | 4908815 | active_count = 0; | |
| 4053 | 4908815 | } | |
| 4054 | |||
| 4055 | 18325316 | mx = mouse_x; | |
| 4056 | 18325316 | my = mouse_y; | |
| 4057 | 18325316 | mz = mouse_z; | |
| 4058 | 18325316 | mb = mouse_b; | |
| 4059 | |||
| 4060 | 18325316 | return idle_count; | |
| 4061 | } | ||
| 4062 | |||
| 4063 | ✗ | int32_t onGoFast() | |
| 4064 | { | ||
| 4065 | ✗ | cheats_enqueue(Cheat::Fast); | |
| 4066 | ✗ | return D_O_K; | |
| 4067 | ✗ | } | |
| 4068 | |||
| 4069 | ✗ | int32_t onKillCheat() | |
| 4070 | { | ||
| 4071 | ✗ | cheats_enqueue(Cheat::Kill); | |
| 4072 | ✗ | return D_O_K; | |
| 4073 | ✗ | } | |
| 4074 | |||
| 4075 | ✗ | int32_t onSecretsCheat() | |
| 4076 | { | ||
| 4077 | ✗ | cheats_enqueue(Cheat::TrigSecrets); | |
| 4078 | ✗ | return D_O_K; | |
| 4079 | ✗ | } | |
| 4080 | ✗ | int32_t onSecretsCheatPerm() | |
| 4081 | { | ||
| 4082 | ✗ | cheats_enqueue(Cheat::TrigSecretsPerm); | |
| 4083 | ✗ | return D_O_K; | |
| 4084 | ✗ | } | |
| 4085 | |||
| 4086 | ✗ | int32_t onShowLayer0() | |
| 4087 | { | ||
| 4088 | ✗ | show_layer_0 = !show_layer_0; | |
| 4089 | ✗ | return D_O_K; | |
| 4090 | } | ||
| 4091 | ✗ | int32_t onShowLayer1() | |
| 4092 | { | ||
| 4093 | ✗ | show_layer_1 = !show_layer_1; | |
| 4094 | ✗ | return D_O_K; | |
| 4095 | } | ||
| 4096 | ✗ | int32_t onShowLayer2() | |
| 4097 | { | ||
| 4098 | ✗ | show_layer_2 = !show_layer_2; | |
| 4099 | ✗ | return D_O_K; | |
| 4100 | } | ||
| 4101 | ✗ | int32_t onShowLayer3() | |
| 4102 | { | ||
| 4103 | ✗ | show_layer_3 = !show_layer_3; | |
| 4104 | ✗ | return D_O_K; | |
| 4105 | } | ||
| 4106 | ✗ | int32_t onShowLayer4() | |
| 4107 | { | ||
| 4108 | ✗ | show_layer_4 = !show_layer_4; | |
| 4109 | ✗ | return D_O_K; | |
| 4110 | } | ||
| 4111 | ✗ | int32_t onShowLayer5() | |
| 4112 | { | ||
| 4113 | ✗ | show_layer_5 = !show_layer_5; | |
| 4114 | ✗ | return D_O_K; | |
| 4115 | } | ||
| 4116 | ✗ | int32_t onShowLayer6() | |
| 4117 | { | ||
| 4118 | ✗ | show_layer_6 = !show_layer_6; | |
| 4119 | ✗ | return D_O_K; | |
| 4120 | } | ||
| 4121 | ✗ | int32_t onShowLayerO() | |
| 4122 | { | ||
| 4123 | ✗ | show_layer_over=!show_layer_over; | |
| 4124 | ✗ | return D_O_K; | |
| 4125 | } | ||
| 4126 | ✗ | int32_t onShowLayerP() | |
| 4127 | { | ||
| 4128 | ✗ | show_layer_push=!show_layer_push; | |
| 4129 | ✗ | return D_O_K; | |
| 4130 | } | ||
| 4131 | ✗ | int32_t onShowLayerS() | |
| 4132 | { | ||
| 4133 | ✗ | show_sprites=!show_sprites; | |
| 4134 | ✗ | return D_O_K; | |
| 4135 | } | ||
| 4136 | ✗ | int32_t onShowLayerF() | |
| 4137 | { | ||
| 4138 | ✗ | show_ffcs=!show_ffcs; | |
| 4139 | ✗ | return D_O_K; | |
| 4140 | } | ||
| 4141 | ✗ | int32_t onShowLayerW() | |
| 4142 | { | ||
| 4143 | ✗ | show_walkflags=!show_walkflags; | |
| 4144 | ✗ | if(show_walkflags) | |
| 4145 | ✗ | show_effectflags = false; | |
| 4146 | ✗ | return D_O_K; | |
| 4147 | } | ||
| 4148 | ✗ | int32_t onShowLayerE() | |
| 4149 | { | ||
| 4150 | ✗ | show_effectflags=!show_effectflags; | |
| 4151 | ✗ | if(show_effectflags) | |
| 4152 | ✗ | show_walkflags = false; | |
| 4153 | ✗ | return D_O_K; | |
| 4154 | } | ||
| 4155 | ✗ | int32_t onShowFFScripts() | |
| 4156 | { | ||
| 4157 | ✗ | show_ff_scripts=!show_ff_scripts; | |
| 4158 | ✗ | return D_O_K; | |
| 4159 | } | ||
| 4160 | ✗ | int32_t onShowHitboxes() | |
| 4161 | { | ||
| 4162 | ✗ | show_hitboxes=!show_hitboxes; | |
| 4163 | ✗ | return D_O_K; | |
| 4164 | } | ||
| 4165 | ✗ | int32_t onShowInfoOpacity() | |
| 4166 | { | ||
| 4167 | ✗ | info_opacity = vbound(getnumber("Debug Info Opacity",info_opacity),0,255); | |
| 4168 | ✗ | zc_set_config("zc","debug_info_opacity",info_opacity); | |
| 4169 | ✗ | return D_O_K; | |
| 4170 | } | ||
| 4171 | |||
| 4172 | ✗ | int32_t onLightSwitch() | |
| 4173 | { | ||
| 4174 | ✗ | cheats_enqueue(Cheat::Light); | |
| 4175 | ✗ | return D_O_K; | |
| 4176 | ✗ | } | |
| 4177 | |||
| 4178 | int32_t onGoTo(); | ||
| 4179 | int32_t onGoToComplete(); | ||
| 4180 | |||
| 4181 | 18325316 | bool handle_close_btn_quit() | |
| 4182 | { | ||
| 4183 |
1/2✓ Branch 0 taken 18325316 times.
✗ Branch 1 not taken.
|
18325316 | if(close_button_quit) |
| 4184 | { | ||
| 4185 | ✗ | close_button_quit=false; | |
| 4186 | ✗ | f_Quit(qEXIT); | |
| 4187 | ✗ | } | |
| 4188 | 18325316 | return (exiting_program = Quit==qEXIT); | |
| 4189 | } | ||
| 4190 | |||
| 4191 | 18325316 | void syskeys() | |
| 4192 | { | ||
| 4193 | 18325316 | update_system_keys(); | |
| 4194 | |||
| 4195 | int32_t oldtitle_version; | ||
| 4196 | |||
| 4197 | 18325316 | poll_joystick(); | |
| 4198 | |||
| 4199 | 18325316 | handle_close_btn_quit(); | |
| 4200 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18325316 times.
|
18325316 | if(Quit == qEXIT) return; |
| 4201 | |||
| 4202 |
2/10✓ Branch 0 taken 18325316 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 18325316 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
18325316 | if(rMbtn() || (gui_mouse_b() && !mouse_down && ClickToFreeze &&!disableClickToFreeze)) |
| 4203 | { | ||
| 4204 | ✗ | System(); | |
| 4205 | ✗ | } | |
| 4206 | |||
| 4207 | 18325316 | mouse_down=gui_mouse_b(); | |
| 4208 | |||
| 4209 |
1/2✓ Branch 0 taken 18325316 times.
✗ Branch 1 not taken.
|
18325316 | if(zc_read_system_key(KEY_F1)) |
| 4210 | { | ||
| 4211 | ✗ | if(zc_get_system_key(KEY_ZC_LCONTROL) || zc_get_system_key(KEY_ZC_RCONTROL)) | |
| 4212 | { | ||
| 4213 | ✗ | halt=!halt; | |
| 4214 | //zinit.subscreen=(zinit.subscreen+1)%ssdtMAX; | ||
| 4215 | ✗ | } | |
| 4216 | else | ||
| 4217 | { | ||
| 4218 | ✗ | Throttlefps=!Throttlefps; | |
| 4219 | ✗ | zc_set_config(cfg_sect,"throttlefps", (int32_t)Throttlefps); | |
| 4220 | } | ||
| 4221 | ✗ | } | |
| 4222 | |||
| 4223 |
1/2✓ Branch 0 taken 18325316 times.
✗ Branch 1 not taken.
|
18325316 | if(zc_read_system_key(KEY_F2)) |
| 4224 | { | ||
| 4225 | ✗ | ShowFPS=!ShowFPS; | |
| 4226 | ✗ | zc_set_config(cfg_sect,"showfps",(int32_t)ShowFPS); | |
| 4227 | ✗ | } | |
| 4228 | |||
| 4229 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 18325316 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
18325316 | if(zc_read_system_key(KEY_F3) && Playing) Paused=!Paused; |
| 4230 | |||
| 4231 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 18325316 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
18325316 | if(zc_read_system_key(KEY_F4) && Playing) |
| 4232 | { | ||
| 4233 | ✗ | Paused=true; | |
| 4234 | ✗ | Advance=true; | |
| 4235 | ✗ | } | |
| 4236 | |||
| 4237 |
1/2✓ Branch 0 taken 18325316 times.
✗ Branch 1 not taken.
|
18325316 | if(zc_read_system_key(KEY_F6)) onTryQuit(); |
| 4238 | |||
| 4239 | #ifndef ALLEGRO_MACOSX | ||
| 4240 |
1/2✓ Branch 0 taken 18325316 times.
✗ Branch 1 not taken.
|
18325316 | if(zc_read_system_key(KEY_F9)) f_Quit(qRESET); |
| 4241 | |||
| 4242 |
1/2✓ Branch 0 taken 18325316 times.
✗ Branch 1 not taken.
|
18325316 | if(zc_read_system_key(KEY_F10)) f_Quit(qEXIT); |
| 4243 | #else | ||
| 4244 | if(zc_read_system_key(KEY_F7)) f_Quit(qRESET); | ||
| 4245 | |||
| 4246 | if(zc_read_system_key(KEY_F8)) f_Quit(qEXIT); | ||
| 4247 | #endif | ||
| 4248 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 18325316 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
18325316 | if(zc_read_system_key(KEY_F5)&&(Playing && currscr<128 && DMaps[currdmap].flags&dmfVIEWMAP)) onSaveMapPic(); |
| 4249 | |||
| 4250 |
1/2✓ Branch 0 taken 18325316 times.
✗ Branch 1 not taken.
|
18325316 | if (zc_read_system_key(KEY_F12)) |
| 4251 | { | ||
| 4252 | ✗ | onSnapshot(); | |
| 4253 | ✗ | } | |
| 4254 | |||
| 4255 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 18325316 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
18325316 | if(debug_enabled && zc_read_system_key(KEY_TAB)) |
| 4256 | ✗ | set_debug(!get_debug()); | |
| 4257 | |||
| 4258 |
1/2✓ Branch 0 taken 18325316 times.
✗ Branch 1 not taken.
|
18325316 | if(CheatModifierKeys()) |
| 4259 | { | ||
| 4260 | ✗ | for(Cheat c = (Cheat)1; c < Cheat::Last; c = (Cheat)(c+1)) | |
| 4261 | { | ||
| 4262 | ✗ | if(!bindable_cheat(c)) | |
| 4263 | ✗ | continue; | |
| 4264 | ✗ | if(get_debug() || cheat >= cheat_lvl(c)) | |
| 4265 | { | ||
| 4266 | ✗ | if(checkcheat(c)) | |
| 4267 | ✗ | cheats_hit_bind(c); | |
| 4268 | ✗ | } | |
| 4269 | ✗ | } | |
| 4270 | ✗ | } | |
| 4271 | |||
| 4272 |
1/2✓ Branch 0 taken 18325316 times.
✗ Branch 1 not taken.
|
18325316 | if(volkeys) |
| 4273 | { | ||
| 4274 | ✗ | if(zc_read_system_key(KEY_PGUP)) master_volume(-1,midi_volume+8); | |
| 4275 | |||
| 4276 | ✗ | if(zc_read_system_key(KEY_PGDN)) master_volume(-1,midi_volume==255?248:midi_volume-8); | |
| 4277 | |||
| 4278 | ✗ | if(zc_read_system_key(KEY_HOME)) master_volume(digi_volume+8,-1); | |
| 4279 | |||
| 4280 | ✗ | if(zc_read_system_key(KEY_END)) master_volume(digi_volume==255?248:digi_volume-8,-1); | |
| 4281 | ✗ | } | |
| 4282 | |||
| 4283 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 18325316 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
18325316 | if(!get_debug() || !SystemKeys || replay_is_replaying()) |
| 4284 | 18325316 | goto bottom; | |
| 4285 | |||
| 4286 | ✗ | if(zc_readkey(KEY_P)) Paused=!Paused; | |
| 4287 | |||
| 4288 | ✗ | if(zc_readkey(KEY_A)) | |
| 4289 | { | ||
| 4290 | ✗ | Paused=true; | |
| 4291 | ✗ | Advance=true; | |
| 4292 | ✗ | } | |
| 4293 | |||
| 4294 | ✗ | if(zc_readkey(KEY_G)) db=(db==999)?0:999; | |
| 4295 | #ifndef ALLEGRO_MACOSX | ||
| 4296 | ✗ | if(zc_readkey(KEY_F8)) Showpal=!Showpal; | |
| 4297 | |||
| 4298 | ✗ | if(zc_readkey(KEY_F7)) | |
| 4299 | { | ||
| 4300 | ✗ | Matrix(ss_speed, ss_density, 0); | |
| 4301 | ✗ | game_pal(); | |
| 4302 | ✗ | } | |
| 4303 | #else | ||
| 4304 | // The reason these are different on Mac in the first place is that | ||
| 4305 | // the OS doesn't let us use F9 and F10... | ||
| 4306 | if(zc_readkey(KEY_F10)) Showpal=!Showpal; | ||
| 4307 | |||
| 4308 | if(zc_readkey(KEY_F9)) | ||
| 4309 | { | ||
| 4310 | Matrix(ss_speed, ss_density, 0); | ||
| 4311 | game_pal(); | ||
| 4312 | } | ||
| 4313 | #endif | ||
| 4314 | ✗ | if(zc_readkey(KEY_PLUS_PAD) || zc_readkey(KEY_EQUALS)) | |
| 4315 | { | ||
| 4316 | //change containers | ||
| 4317 | ✗ | if(zc_getkey(KEY_ZC_LCONTROL) || zc_getkey(KEY_ZC_RCONTROL)) | |
| 4318 | { | ||
| 4319 | //magic containers | ||
| 4320 | ✗ | if(zc_getkey(KEY_LSHIFT) || zc_getkey(KEY_RSHIFT)) | |
| 4321 | { | ||
| 4322 | ✗ | game->set_maxmagic(zc_min(game->get_maxmagic()+game->get_mp_per_block(),game->get_mp_per_block()*8)); | |
| 4323 | ✗ | } | |
| 4324 | else | ||
| 4325 | { | ||
| 4326 | ✗ | game->set_maxlife(zc_min(game->get_maxlife()+game->get_hp_per_heart(),game->get_hp_per_heart()*24)); | |
| 4327 | } | ||
| 4328 | ✗ | } | |
| 4329 | else | ||
| 4330 | { | ||
| 4331 | ✗ | if(zc_getkey(KEY_LSHIFT) || zc_getkey(KEY_RSHIFT)) | |
| 4332 | { | ||
| 4333 | ✗ | game->set_magic(zc_min(game->get_magic()+1,game->get_maxmagic())); | |
| 4334 | ✗ | } | |
| 4335 | else | ||
| 4336 | { | ||
| 4337 | ✗ | game->set_life(zc_min(game->get_life()+1,game->get_maxlife())); | |
| 4338 | } | ||
| 4339 | } | ||
| 4340 | ✗ | } | |
| 4341 | |||
| 4342 | ✗ | if(zc_readkey(KEY_MINUS_PAD) || zc_readkey(KEY_MINUS)) | |
| 4343 | { | ||
| 4344 | //change containers | ||
| 4345 | ✗ | if(zc_getkey(KEY_ZC_LCONTROL) || zc_getkey(KEY_ZC_RCONTROL)) | |
| 4346 | { | ||
| 4347 | //magic containers | ||
| 4348 | ✗ | if(zc_getkey(KEY_LSHIFT) || zc_getkey(KEY_RSHIFT)) | |
| 4349 | { | ||
| 4350 | ✗ | game->set_maxmagic(zc_max(game->get_maxmagic()-game->get_mp_per_block(),0)); | |
| 4351 | ✗ | game->set_magic(zc_min(game->get_maxmagic(), game->get_magic())); | |
| 4352 | //heart containers | ||
| 4353 | ✗ | } | |
| 4354 | else | ||
| 4355 | { | ||
| 4356 | ✗ | game->set_maxlife(zc_max(game->get_maxlife()-game->get_hp_per_heart(),game->get_hp_per_heart())); | |
| 4357 | ✗ | game->set_life(zc_min(game->get_maxlife(), game->get_life())); | |
| 4358 | } | ||
| 4359 | ✗ | } | |
| 4360 | else | ||
| 4361 | { | ||
| 4362 | ✗ | if(zc_getkey(KEY_LSHIFT) || zc_getkey(KEY_RSHIFT)) | |
| 4363 | { | ||
| 4364 | ✗ | game->set_magic(zc_max(game->get_magic()-1,0)); | |
| 4365 | ✗ | } | |
| 4366 | else | ||
| 4367 | { | ||
| 4368 | ✗ | game->set_life(zc_max(game->get_life()-1,0)); | |
| 4369 | } | ||
| 4370 | } | ||
| 4371 | ✗ | } | |
| 4372 | |||
| 4373 | ✗ | if(zc_readkey(KEY_COMMA)) jukebox(currmidi-1); | |
| 4374 | |||
| 4375 | ✗ | if(zc_readkey(KEY_STOP)) jukebox(currmidi+1); | |
| 4376 | |||
| 4377 | ✗ | verifyBothWeapons(); | |
| 4378 | |||
| 4379 | bottom: | ||
| 4380 | |||
| 4381 |
1/2✓ Branch 0 taken 18325316 times.
✗ Branch 1 not taken.
|
18325316 | if(input_idle(true) > after_time()) |
| 4382 | { | ||
| 4383 | ✗ | Matrix(ss_speed, ss_density, 0); | |
| 4384 | ✗ | game_pal(); | |
| 4385 | ✗ | } | |
| 4386 | 18325316 | } | |
| 4387 | |||
| 4388 | 1128630 | void checkQuitKeys() | |
| 4389 | { | ||
| 4390 | #ifndef ALLEGRO_MACOSX | ||
| 4391 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1128630 times.
|
1128630 | if(key[KEY_F9]) f_Quit(qRESET); |
| 4392 | |||
| 4393 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1128630 times.
|
1128630 | if(key[KEY_F10]) f_Quit(qEXIT); |
| 4394 | #else | ||
| 4395 | if(key[KEY_F7]) f_Quit(qRESET); | ||
| 4396 | |||
| 4397 | if(key[KEY_F8]) f_Quit(qEXIT); | ||
| 4398 | #endif | ||
| 4399 | 1128630 | } | |
| 4400 | |||
| 4401 | 18325516 | bool CheatModifierKeys() | |
| 4402 | { | ||
| 4403 | // Cheats are replayed via the X cheat step, no need to check for keyboard input | ||
| 4404 | // to trigger cheats. | ||
| 4405 |
2/2✓ Branch 0 taken 18325216 times.
✓ Branch 1 taken 300 times.
|
18325516 | if (replay_is_replaying()) |
| 4406 | 18325216 | return false; | |
| 4407 | |||
| 4408 |
3/4✓ Branch 0 taken 100 times.
✓ Branch 1 taken 200 times.
✓ Branch 2 taken 100 times.
✗ Branch 3 not taken.
|
300 | if ( ( cheat_modifier_keys[0] > 0 && key[cheat_modifier_keys[0]] ) || |
| 4409 |
2/2✓ Branch 0 taken 100 times.
✓ Branch 1 taken 100 times.
|
200 | ( cheat_modifier_keys[1] > 0 && key[cheat_modifier_keys[1]] ) || |
| 4410 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 100 times.
|
100 | (cheat_modifier_keys[0] <= 0 && cheat_modifier_keys[1] <= 0)) |
| 4411 | { | ||
| 4412 |
0/4✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
200 | if ( ( cheat_modifier_keys[2] <= 0 || key[cheat_modifier_keys[2]] ) || |
| 4413 | ✗ | ( cheat_modifier_keys[3] > 0 && key[cheat_modifier_keys[3]] ) || | |
| 4414 | ✗ | (cheat_modifier_keys[2] <= 0 && cheat_modifier_keys[3] <= 0)) | |
| 4415 | { | ||
| 4416 | ✗ | return true; | |
| 4417 | } | ||
| 4418 | ✗ | } | |
| 4419 | 100 | return false; | |
| 4420 | 18325316 | } | |
| 4421 | |||
| 4422 | //99:05:54, for some reason? | ||
| 4423 | #define OLDMAXTIME 21405240 | ||
| 4424 | //9000:00:00, the highest even-thousand hour fitting within 32b signed. This is 375 *DAYS*. | ||
| 4425 | #define MAXTIME 1944000000 | ||
| 4426 | |||
| 4427 | 18326659 | void advanceframe(bool allowwavy, bool sfxcleanup, bool allowF6Script) | |
| 4428 | { | ||
| 4429 |
1/2✓ Branch 0 taken 18326659 times.
✗ Branch 1 not taken.
|
18326659 | if(zcmusic!=NULL) |
| 4430 | { | ||
| 4431 | ✗ | zcmusic_poll(); | |
| 4432 | ✗ | } | |
| 4433 | 18326659 | zcmixer_update(zcmixer, emusic_volume, FFCore.usr_music_volume, get_qr(qr_OLD_SCRIPT_VOLUME)); | |
| 4434 | |||
| 4435 | 18326659 | updatescr(allowwavy); | |
| 4436 | |||
| 4437 | 18326659 | Advance=false; | |
| 4438 |
2/6✗ Branch 0 not taken.
✓ Branch 1 taken 18326659 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 18326659 times.
|
18326659 | while(Paused && !Advance && !Quit) |
| 4439 | { | ||
| 4440 | // have to call this, otherwise we'll get an infinite loop | ||
| 4441 | ✗ | syskeys(); | |
| 4442 | ✗ | if(allowF6Script) | |
| 4443 | { | ||
| 4444 | ✗ | FFCore.runF6Engine(); | |
| 4445 | ✗ | } | |
| 4446 | |||
| 4447 | #ifdef _WIN32 | ||
| 4448 | |||
| 4449 | if(use_dwm_flush) | ||
| 4450 | { | ||
| 4451 | do_DwmFlush(); | ||
| 4452 | } | ||
| 4453 | |||
| 4454 | #endif | ||
| 4455 | |||
| 4456 | // to keep music playing | ||
| 4457 | ✗ | if(zcmusic!=NULL) | |
| 4458 | { | ||
| 4459 | ✗ | zcmusic_poll(); | |
| 4460 | ✗ | } | |
| 4461 | |||
| 4462 | ✗ | update_hw_screen(); | |
| 4463 | } | ||
| 4464 | |||
| 4465 |
2/2✓ Branch 0 taken 18325360 times.
✓ Branch 1 taken 1299 times.
|
18326659 | if(Quit) |
| 4466 | 1299 | return; | |
| 4467 | |||
| 4468 |
3/4✓ Branch 0 taken 17812259 times.
✓ Branch 1 taken 513101 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 17812259 times.
|
18325360 | if(Playing && game->get_time()<unsigned(get_qr(qr_GREATER_MAX_TIME) ? MAXTIME : OLDMAXTIME)) |
| 4469 | 17812259 | game->change_time(1); | |
| 4470 | |||
| 4471 | // Many mistakes have been make re: inputs, and we are stuck with many replays relying on those mistakes. | ||
| 4472 | |||
| 4473 | 18325360 | bool should_reset_down_state = !get_qr(qr_BROKEN_INPUT_DOWN_STATE); | |
| 4474 |
2/2✓ Branch 0 taken 8615061 times.
✓ Branch 1 taken 9710299 times.
|
18325360 | if (replay_version_check(0, 16)) |
| 4475 | 9710299 | should_reset_down_state = replay_version_check(11, 16); | |
| 4476 |
2/2✓ Branch 0 taken 14976690 times.
✓ Branch 1 taken 3348670 times.
|
18325360 | if (should_reset_down_state) |
| 4477 | { | ||
| 4478 |
2/2✓ Branch 0 taken 60276060 times.
✓ Branch 1 taken 3348670 times.
|
63624730 | for (int i = 0; i < ZC_CONTROL_STATES; i++) |
| 4479 | 60276060 | down_control_states[i] = raw_control_state[i]; | |
| 4480 | 3348670 | } | |
| 4481 | |||
| 4482 |
2/2✓ Branch 0 taken 44 times.
✓ Branch 1 taken 18325316 times.
|
18325360 | if (replay_is_active()) |
| 4483 | { | ||
| 4484 |
2/2✓ Branch 0 taken 1545413 times.
✓ Branch 1 taken 16779903 times.
|
18325316 | if (replay_version_check(3)) |
| 4485 | 16779903 | replay_poll(); | |
| 4486 | |||
| 4487 |
4/4✓ Branch 0 taken 7389596 times.
✓ Branch 1 taken 10935720 times.
✓ Branch 2 taken 100535 times.
✓ Branch 3 taken 7289061 times.
|
18325316 | if (replay_version_check(11) || replay_version_check(6, 8)) |
| 4488 | 11036255 | replay_peek_input(); | |
| 4489 | 18325316 | } | |
| 4490 | |||
| 4491 | 18325360 | load_control_called_this_frame = false; | |
| 4492 | |||
| 4493 | 18325360 | poll_keyboard(); | |
| 4494 | 18325360 | update_keys(); | |
| 4495 | |||
| 4496 | 18325360 | ++frame; | |
| 4497 | |||
| 4498 |
2/2✓ Branch 0 taken 144 times.
✓ Branch 1 taken 18325216 times.
|
18325360 | if (replay_is_replaying()) |
| 4499 | 18325216 | replay_do_cheats(); | |
| 4500 | 18325360 | syskeys(); | |
| 4501 | |||
| 4502 | // The mouse variables can change from the mouse thread at anytime during a frame, | ||
| 4503 | // so save the result at the start so that replaying is consistent. | ||
| 4504 | 18325360 | script_mouse_x = gui_mouse_x(); | |
| 4505 | 18325360 | script_mouse_y = gui_mouse_y(); | |
| 4506 | 18325360 | script_mouse_z = mouse_z; | |
| 4507 | 18325360 | script_mouse_b = mouse_b; | |
| 4508 | |||
| 4509 | // Cheats used via the System menu (called by syskeys) will call cheats_enqueue. syskeys | ||
| 4510 | // is called just above, and in the paused loop above, so the queue-and-defer-slightly | ||
| 4511 | // approach here means it doesn't matter which call adds the cheat. | ||
| 4512 | 18325360 | cheats_execute_queued(); | |
| 4513 | |||
| 4514 |
2/2✓ Branch 0 taken 144 times.
✓ Branch 1 taken 18325216 times.
|
18325360 | if (replay_is_replaying()) |
| 4515 | 18325216 | replay_peek_quit(); | |
| 4516 |
2/2✓ Branch 0 taken 18325299 times.
✓ Branch 1 taken 61 times.
|
18325360 | if (GameFlags & GAMEFLAG_TRYQUIT) |
| 4517 | 61 | replay_step_quit(0); | |
| 4518 |
2/2✓ Branch 0 taken 3694 times.
✓ Branch 1 taken 18321666 times.
|
18325360 | if(allowF6Script) |
| 4519 | 18321666 | FFCore.runF6Engine(); | |
| 4520 |
2/2✓ Branch 0 taken 740 times.
✓ Branch 1 taken 18324620 times.
|
18325360 | if (Quit) |
| 4521 | 740 | replay_step_quit(Quit); | |
| 4522 | |||
| 4523 | #ifdef _WIN32 | ||
| 4524 | |||
| 4525 | if(use_dwm_flush) | ||
| 4526 | { | ||
| 4527 | do_DwmFlush(); | ||
| 4528 | } | ||
| 4529 | |||
| 4530 | #endif | ||
| 4531 | |||
| 4532 |
2/2✓ Branch 0 taken 208652 times.
✓ Branch 1 taken 18116708 times.
|
18325360 | if(sfxcleanup) |
| 4533 | 18116708 | sfx_cleanup(); | |
| 4534 | |||
| 4535 | 18325360 | jit_poll(); | |
| 4536 | |||
| 4537 | #ifdef __EMSCRIPTEN__ | ||
| 4538 | // Yield the main thread back to the browser occasionally. | ||
| 4539 | if (is_headless()) | ||
| 4540 | { | ||
| 4541 | static int rate = 10000; | ||
| 4542 | static int force_yield = rate; | ||
| 4543 | if (force_yield++ >= rate) | ||
| 4544 | { | ||
| 4545 | force_yield = 0; | ||
| 4546 | emscripten_sleep(0); | ||
| 4547 | } | ||
| 4548 | } | ||
| 4549 | #endif | ||
| 4550 | |||
| 4551 |
4/6✓ Branch 0 taken 256 times.
✓ Branch 1 taken 18325104 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 256 times.
✓ Branch 4 taken 256 times.
✗ Branch 5 not taken.
|
18325360 | static bool test_mode_auto_restart = zc_get_config("zeldadx", "test_mode_auto_restart", false); |
| 4552 |
3/4✓ Branch 0 taken 100 times.
✓ Branch 1 taken 18325260 times.
✓ Branch 2 taken 100 times.
✗ Branch 3 not taken.
|
18325360 | if (zqtesting_mode && test_mode_auto_restart) |
| 4553 | { | ||
| 4554 | ✗ | static auto last_write_time = fs::last_write_time(qstpath); | |
| 4555 | ✗ | static auto last_check = std::chrono::system_clock::now(); | |
| 4556 | |||
| 4557 | ✗ | if (std::chrono::system_clock::now() - last_check > 200ms) | |
| 4558 | { | ||
| 4559 | ✗ | last_check = std::chrono::system_clock::now(); | |
| 4560 | ✗ | auto write_time = fs::last_write_time(qstpath); | |
| 4561 | ✗ | if (last_write_time != write_time) | |
| 4562 | { | ||
| 4563 | ✗ | last_write_time = write_time; | |
| 4564 | ✗ | disableClickToFreeze = false; | |
| 4565 | ✗ | Quit = qRESET; | |
| 4566 | ✗ | replay_quit(); | |
| 4567 | ✗ | } | |
| 4568 | ✗ | } | |
| 4569 | ✗ | } | |
| 4570 | 18326659 | } | |
| 4571 | |||
| 4572 | 589 | void zapout() | |
| 4573 | { | ||
| 4574 | 589 | set_clip_rect(scrollbuf, 0, 0, scrollbuf->w, scrollbuf->h); | |
| 4575 | 589 | blit(framebuf,scrollbuf,0,0,256,0,256,224); | |
| 4576 | |||
| 4577 | 589 | FFCore.runGenericPassiveEngine(SCR_TIMING_END_FRAME); | |
| 4578 | 589 | script_drawing_commands.Clear(); | |
| 4579 | |||
| 4580 | // zap out | ||
| 4581 |
2/2✓ Branch 0 taken 589 times.
✓ Branch 1 taken 14136 times.
|
14725 | for(int32_t i=1; i<=24; i++) |
| 4582 | { | ||
| 4583 | 14136 | draw_fuzzy(i); | |
| 4584 | 14136 | advanceframe(true); | |
| 4585 | |||
| 4586 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14136 times.
|
14136 | if(Quit) |
| 4587 | { | ||
| 4588 | ✗ | break; | |
| 4589 | } | ||
| 4590 | 14136 | } | |
| 4591 | 589 | } | |
| 4592 | |||
| 4593 | 587 | void zapin() | |
| 4594 | { | ||
| 4595 | 587 | FFCore.warpScriptCheck(); | |
| 4596 | 587 | draw_screen(tmpscr); | |
| 4597 | 587 | set_clip_rect(scrollbuf, 0, 0, scrollbuf->w, scrollbuf->h); | |
| 4598 | 587 | blit(framebuf,scrollbuf,0,0,256,0,256,224); | |
| 4599 | |||
| 4600 | // zap out | ||
| 4601 | 587 | FFCore.runGenericPassiveEngine(SCR_TIMING_END_FRAME); | |
| 4602 |
2/2✓ Branch 0 taken 587 times.
✓ Branch 1 taken 14088 times.
|
14675 | for(int32_t i=24; i>=1; i--) |
| 4603 | { | ||
| 4604 | 14088 | draw_fuzzy(i); | |
| 4605 | 14088 | advanceframe(true); | |
| 4606 | |||
| 4607 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14088 times.
|
14088 | if(Quit) |
| 4608 | { | ||
| 4609 | ✗ | break; | |
| 4610 | } | ||
| 4611 | 14088 | } | |
| 4612 | 587 | } | |
| 4613 | |||
| 4614 | |||
| 4615 | 235 | void wavyout(bool showhero) | |
| 4616 | { | ||
| 4617 | 235 | draw_screen(tmpscr, showhero); | |
| 4618 | |||
| 4619 | 235 | BITMAP *wavebuf = create_bitmap_ex(8,288,224); | |
| 4620 | 235 | clear_to_color(wavebuf,0); | |
| 4621 | 235 | blit(framebuf,wavebuf,0,0,16,0,256,224); | |
| 4622 | |||
| 4623 | static PALETTE wavepal; | ||
| 4624 | |||
| 4625 | int32_t ofs; | ||
| 4626 | 235 | int32_t amplitude=8; | |
| 4627 | |||
| 4628 | 235 | int32_t wavelength=4; | |
| 4629 | 235 | double palpos=0, palstep=4, palstop=126; | |
| 4630 | |||
| 4631 | 235 | FFCore.runGenericPassiveEngine(SCR_TIMING_END_FRAME); | |
| 4632 |
2/2✓ Branch 0 taken 234 times.
✓ Branch 1 taken 9845 times.
|
10079 | for(int32_t i=0; i<168; i+=wavelength) |
| 4633 | { | ||
| 4634 |
2/2✓ Branch 0 taken 2520320 times.
✓ Branch 1 taken 9845 times.
|
2530165 | for(int32_t l=0; l<256; l++) |
| 4635 | { | ||
| 4636 | 2520320 | wavepal[l].r=vbound(int32_t(RAMpal[l].r+((palpos/palstop)*(255-RAMpal[l].r))),0,255); | |
| 4637 | 2520320 | wavepal[l].g=vbound(int32_t(RAMpal[l].g+((palpos/palstop)*(255-RAMpal[l].g))),0,255); | |
| 4638 | 2520320 | wavepal[l].b=vbound(int32_t(RAMpal[l].b+((palpos/palstop)*(255-RAMpal[l].b))),0,255); | |
| 4639 | 2520320 | } | |
| 4640 | |||
| 4641 | 9845 | palpos+=palstep; | |
| 4642 | |||
| 4643 |
1/2✓ Branch 0 taken 9845 times.
✗ Branch 1 not taken.
|
9845 | if(palpos>=0) |
| 4644 | { | ||
| 4645 | 9845 | hw_palette = &wavepal; | |
| 4646 | 9845 | update_hw_pal = true; | |
| 4647 | 9845 | } | |
| 4648 | else | ||
| 4649 | { | ||
| 4650 | ✗ | hw_palette = &RAMpal; | |
| 4651 | ✗ | update_hw_pal = true; | |
| 4652 | } | ||
| 4653 | |||
| 4654 |
2/2✓ Branch 0 taken 1653960 times.
✓ Branch 1 taken 9845 times.
|
1663805 | for(int32_t j=0; j+playing_field_offset<224; j++) |
| 4655 | { | ||
| 4656 |
2/2✓ Branch 0 taken 423413760 times.
✓ Branch 1 taken 1653960 times.
|
425067720 | for(int32_t k=0; k<256; k++) |
| 4657 | { | ||
| 4658 | 423413760 | ofs=0; | |
| 4659 | |||
| 4660 |
4/4✓ Branch 0 taken 206448640 times.
✓ Branch 1 taken 216965120 times.
✓ Branch 2 taken 103224320 times.
✓ Branch 3 taken 103224320 times.
|
423413760 | if((j<i)&&(j&1)) |
| 4661 | { | ||
| 4662 | 103224320 | ofs=int32_t(zc::math::Sin((double(i+j)*2*PI/168.0))*amplitude); | |
| 4663 | 103224320 | } | |
| 4664 | |||
| 4665 | 423413760 | framebuf->line[j+playing_field_offset][k]=wavebuf->line[j+playing_field_offset][k+ofs+16]; | |
| 4666 | 423413760 | } | |
| 4667 | 1653960 | } | |
| 4668 | |||
| 4669 | 9845 | advanceframe(true); | |
| 4670 | |||
| 4671 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 9844 times.
|
9845 | if(Quit) |
| 4672 | 1 | break; | |
| 4673 | 9844 | } | |
| 4674 | |||
| 4675 | 235 | destroy_bitmap(wavebuf); | |
| 4676 | |||
| 4677 | 235 | hw_palette = &RAMpal; | |
| 4678 | 235 | update_hw_pal = true; | |
| 4679 | 235 | } | |
| 4680 | |||
| 4681 | 232 | void wavyin() | |
| 4682 | { | ||
| 4683 | 232 | draw_screen(tmpscr); | |
| 4684 | |||
| 4685 | 232 | BITMAP *wavebuf = create_bitmap_ex(8,288,224); | |
| 4686 | 232 | clear_to_color(wavebuf,0); | |
| 4687 | 232 | blit(framebuf,wavebuf,0,0,16,0,256,224); | |
| 4688 | |||
| 4689 | static PALETTE wavepal; | ||
| 4690 | |||
| 4691 | 232 | refreshpal=false; | |
| 4692 | int32_t ofs; | ||
| 4693 | 232 | int32_t amplitude=8; | |
| 4694 | 232 | int32_t wavelength=4; | |
| 4695 | 232 | double palpos=168, palstep=4, palstop=126; | |
| 4696 | |||
| 4697 | 232 | FFCore.runGenericPassiveEngine(SCR_TIMING_END_FRAME); | |
| 4698 |
2/2✓ Branch 0 taken 231 times.
✓ Branch 1 taken 9703 times.
|
9934 | for(int32_t i=0; i<168; i+=wavelength) |
| 4699 | { | ||
| 4700 |
2/2✓ Branch 0 taken 2483968 times.
✓ Branch 1 taken 9703 times.
|
2493671 | for(int32_t l=0; l<256; l++) |
| 4701 | { | ||
| 4702 | 2483968 | wavepal[l].r=vbound(int32_t(RAMpal[l].r+((palpos/palstop)*(255-RAMpal[l].r))),0,255); | |
| 4703 | 2483968 | wavepal[l].g=vbound(int32_t(RAMpal[l].g+((palpos/palstop)*(255-RAMpal[l].g))),0,255); | |
| 4704 | 2483968 | wavepal[l].b=vbound(int32_t(RAMpal[l].b+((palpos/palstop)*(255-RAMpal[l].b))),0,255); | |
| 4705 | 2483968 | } | |
| 4706 | |||
| 4707 | 9703 | palpos-=palstep; | |
| 4708 | |||
| 4709 |
1/2✓ Branch 0 taken 9703 times.
✗ Branch 1 not taken.
|
9703 | if(palpos>=0) |
| 4710 | { | ||
| 4711 | 9703 | hw_palette = &wavepal; | |
| 4712 | 9703 | update_hw_pal = true; | |
| 4713 | 9703 | } | |
| 4714 | else | ||
| 4715 | { | ||
| 4716 | ✗ | hw_palette = &RAMpal; | |
| 4717 | ✗ | update_hw_pal = true; | |
| 4718 | } | ||
| 4719 | |||
| 4720 |
2/2✓ Branch 0 taken 1630104 times.
✓ Branch 1 taken 9703 times.
|
1639807 | for(int32_t j=0; j+playing_field_offset<224; j++) |
| 4721 | { | ||
| 4722 |
2/2✓ Branch 0 taken 417306624 times.
✓ Branch 1 taken 1630104 times.
|
418936728 | for(int32_t k=0; k<256; k++) |
| 4723 | { | ||
| 4724 | 417306624 | ofs=0; | |
| 4725 | |||
| 4726 |
4/4✓ Branch 0 taken 211158272 times.
✓ Branch 1 taken 206148352 times.
✓ Branch 2 taken 106821120 times.
✓ Branch 3 taken 104337152 times.
|
417306624 | if((j<(167-i))&&(j&1)) |
| 4727 | { | ||
| 4728 | 104337152 | ofs=int32_t(zc::math::Sin((double(i+j)*2*PI/168.0))*amplitude); | |
| 4729 | 104337152 | } | |
| 4730 | |||
| 4731 | 417306624 | framebuf->line[j+playing_field_offset][k]=wavebuf->line[j+playing_field_offset][k+ofs+16]; | |
| 4732 | 417306624 | } | |
| 4733 | 1630104 | } | |
| 4734 | |||
| 4735 | 9703 | advanceframe(true); | |
| 4736 | |||
| 4737 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 9702 times.
|
9703 | if(Quit) |
| 4738 | 1 | break; | |
| 4739 | 9702 | } | |
| 4740 | |||
| 4741 | 232 | destroy_bitmap(wavebuf); | |
| 4742 | |||
| 4743 | 232 | hw_palette = &RAMpal; | |
| 4744 | 232 | update_hw_pal = true; | |
| 4745 | 232 | } | |
| 4746 | |||
| 4747 | 4332 | void blackscr(int32_t fcnt,bool showsubscr) | |
| 4748 | { | ||
| 4749 | 4332 | reset_pal_cycling(); | |
| 4750 | 4332 | script_drawing_commands.Clear(); | |
| 4751 | |||
| 4752 | 4332 | FFCore.warpScriptCheck(); | |
| 4753 | 4332 | bool showtime = game->should_show_time(); | |
| 4754 |
2/2✓ Branch 0 taken 4325 times.
✓ Branch 1 taken 129517 times.
|
133842 | while(fcnt>0) |
| 4755 | { | ||
| 4756 | 129517 | clear_bitmap(framebuf); | |
| 4757 | |||
| 4758 |
2/2✓ Branch 0 taken 59250 times.
✓ Branch 1 taken 70267 times.
|
129517 | if(showsubscr) |
| 4759 | { | ||
| 4760 | 70267 | put_passive_subscr(framebuf,0,passive_subscreen_offset,showtime,sspUP); | |
| 4761 |
3/4✓ Branch 0 taken 70267 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1230 times.
✓ Branch 3 taken 69037 times.
|
70267 | if(get_qr(qr_SCRIPTDRAWSINWARPS) || (get_qr(qr_PASSIVE_SUBSCRIPT_RUNS_WHEN_GAME_IS_FROZEN))) |
| 4762 | { | ||
| 4763 | 1230 | do_script_draws(framebuf, tmpscr, 0, playing_field_offset); | |
| 4764 | 1230 | } | |
| 4765 | 70267 | } | |
| 4766 | |||
| 4767 | 129517 | advanceframe(true); | |
| 4768 | |||
| 4769 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 129510 times.
|
129517 | if(Quit) |
| 4770 | 7 | break; | |
| 4771 | |||
| 4772 | 129510 | --fcnt; | |
| 4773 | } | ||
| 4774 | 4332 | } | |
| 4775 | |||
| 4776 | 2670 | void openscreen(int32_t shape) | |
| 4777 | { | ||
| 4778 | 2670 | reset_pal_cycling(); | |
| 4779 | 2670 | black_opening_count=0; | |
| 4780 | |||
| 4781 |
3/4✓ Branch 0 taken 522 times.
✓ Branch 1 taken 2148 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 522 times.
|
2670 | if(COOLSCROLL || shape>-1) |
| 4782 | { | ||
| 4783 | 2148 | open_black_opening(HeroX()+8, (HeroY()-HeroZ()-HeroFakeZ())+8+playing_field_offset, true, shape); | |
| 4784 | 2148 | return; | |
| 4785 | } | ||
| 4786 | else | ||
| 4787 | { | ||
| 4788 | 522 | Hero.setDontDraw(true); | |
| 4789 | 522 | show_subscreen_dmap_dots=false; | |
| 4790 | 522 | show_subscreen_numbers=false; | |
| 4791 | 522 | show_subscreen_life=false; | |
| 4792 | } | ||
| 4793 | |||
| 4794 | 522 | int32_t x=128; | |
| 4795 | |||
| 4796 | 522 | FFCore.warpScriptCheck(); | |
| 4797 |
2/2✓ Branch 0 taken 522 times.
✓ Branch 1 taken 41760 times.
|
42282 | for(int32_t i=0; i<80; i++) |
| 4798 | { | ||
| 4799 | 41760 | draw_screen(tmpscr); | |
| 4800 | 41760 | x=128-(((i*128/80)/8)*8); | |
| 4801 | |||
| 4802 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 41760 times.
|
41760 | if(x>0) |
| 4803 | { | ||
| 4804 | 41760 | rectfill(framebuf,0,playing_field_offset,x,167+playing_field_offset,0); | |
| 4805 | 41760 | rectfill(framebuf,256-x,playing_field_offset,255,167+playing_field_offset,0); | |
| 4806 | 41760 | } | |
| 4807 | |||
| 4808 | 41760 | advanceframe(true); | |
| 4809 | |||
| 4810 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 41760 times.
|
41760 | if(Quit) |
| 4811 | { | ||
| 4812 | ✗ | break; | |
| 4813 | } | ||
| 4814 | 41760 | } | |
| 4815 | |||
| 4816 | 522 | Hero.setDontDraw(false); | |
| 4817 | 522 | show_subscreen_items=true; | |
| 4818 | 522 | show_subscreen_dmap_dots=true; | |
| 4819 | 522 | show_subscreen_numbers=true; | |
| 4820 | 522 | show_subscreen_life=true; | |
| 4821 | 2670 | } | |
| 4822 | |||
| 4823 | 4 | void closescreen(int32_t shape) | |
| 4824 | { | ||
| 4825 | 4 | reset_pal_cycling(); | |
| 4826 | 4 | black_opening_count=0; | |
| 4827 | |||
| 4828 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
4 | if(COOLSCROLL || shape>-1) |
| 4829 | { | ||
| 4830 | 4 | close_black_opening(HeroX()+8, (HeroY()-HeroZ()-HeroFakeZ())+8+playing_field_offset, true, shape); | |
| 4831 | 4 | return; | |
| 4832 | } | ||
| 4833 | else | ||
| 4834 | { | ||
| 4835 | ✗ | Hero.setDontDraw(true); | |
| 4836 | ✗ | show_subscreen_dmap_dots=false; | |
| 4837 | ✗ | show_subscreen_numbers=false; | |
| 4838 | // show_subscreen_items=false; | ||
| 4839 | ✗ | show_subscreen_life=false; | |
| 4840 | } | ||
| 4841 | |||
| 4842 | ✗ | int32_t x=128; | |
| 4843 | |||
| 4844 | ✗ | FFCore.warpScriptCheck(); | |
| 4845 | ✗ | for(int32_t i=79; i>=0; --i) | |
| 4846 | { | ||
| 4847 | ✗ | draw_screen(tmpscr); | |
| 4848 | ✗ | x=128-(((i*128/80)/8)*8); | |
| 4849 | |||
| 4850 | ✗ | if(x>0) | |
| 4851 | { | ||
| 4852 | ✗ | rectfill(framebuf,0,playing_field_offset,x,167+playing_field_offset,0); | |
| 4853 | ✗ | rectfill(framebuf,256-x,playing_field_offset,255,167+playing_field_offset,0); | |
| 4854 | ✗ | } | |
| 4855 | |||
| 4856 | ✗ | advanceframe(true); | |
| 4857 | |||
| 4858 | ✗ | if(Quit) | |
| 4859 | { | ||
| 4860 | ✗ | break; | |
| 4861 | } | ||
| 4862 | ✗ | } | |
| 4863 | |||
| 4864 | ✗ | Hero.setDontDraw(false); | |
| 4865 | ✗ | show_subscreen_items=true; | |
| 4866 | ✗ | show_subscreen_dmap_dots=true; | |
| 4867 | 4 | } | |
| 4868 | |||
| 4869 | 296 | int32_t TriforceCount() | |
| 4870 | { | ||
| 4871 | 296 | int32_t c=0; | |
| 4872 | |||
| 4873 |
2/2✓ Branch 0 taken 2368 times.
✓ Branch 1 taken 296 times.
|
2664 | for(int32_t i=1; i<=8; i++) |
| 4874 |
2/2✓ Branch 0 taken 484 times.
✓ Branch 1 taken 1884 times.
|
4252 | if(game->lvlitems[i]&liTRIFORCE) |
| 4875 | 1884 | ++c; | |
| 4876 | |||
| 4877 | 296 | return c; | |
| 4878 | } | ||
| 4879 | |||
| 4880 | ✗ | int32_t onCustomGame() | |
| 4881 | { | ||
| 4882 | ✗ | int32_t file = getsaveslot(); | |
| 4883 | |||
| 4884 | ✗ | if(file < 0) | |
| 4885 | ✗ | return D_O_K; | |
| 4886 | |||
| 4887 | ✗ | bool ret = (custom_game(file)!=0); | |
| 4888 | ✗ | return ret ? D_CLOSE : D_O_K; | |
| 4889 | ✗ | } | |
| 4890 | |||
| 4891 | ✗ | int32_t onContinue() | |
| 4892 | { | ||
| 4893 | ✗ | return D_CLOSE; | |
| 4894 | } | ||
| 4895 | |||
| 4896 | ✗ | int32_t onThrottleFPS() | |
| 4897 | { | ||
| 4898 | ✗ | Throttlefps = !Throttlefps; | |
| 4899 | ✗ | zc_set_config(cfg_sect,"throttlefps", (int32_t)Throttlefps); | |
| 4900 | ✗ | return D_O_K; | |
| 4901 | } | ||
| 4902 | |||
| 4903 | ✗ | int32_t onWinPosSave() | |
| 4904 | { | ||
| 4905 | ✗ | SaveWinPos = !SaveWinPos; | |
| 4906 | ✗ | zc_set_config(cfg_sect,"save_window_position",(int32_t)SaveWinPos); | |
| 4907 | ✗ | return D_O_K; | |
| 4908 | } | ||
| 4909 | ✗ | int32_t onIntegerScaling() | |
| 4910 | { | ||
| 4911 | ✗ | scaleForceInteger = !scaleForceInteger; | |
| 4912 | ✗ | zc_set_config("zeldadx","scaling_force_integer",(int)scaleForceInteger); | |
| 4913 | ✗ | return D_O_K; | |
| 4914 | } | ||
| 4915 | ✗ | int32_t onStretchGame() | |
| 4916 | { | ||
| 4917 | ✗ | stretchGame = !stretchGame; | |
| 4918 | ✗ | zc_set_config("zeldadx","stretch_game_area",stretchGame?1:0); | |
| 4919 | ✗ | return D_O_K; | |
| 4920 | } | ||
| 4921 | |||
| 4922 | ✗ | int32_t onClickToFreeze() | |
| 4923 | { | ||
| 4924 | ✗ | ClickToFreeze = !ClickToFreeze; | |
| 4925 | ✗ | zc_set_config(cfg_sect,"clicktofreeze", (int32_t)ClickToFreeze); | |
| 4926 | ✗ | return D_O_K; | |
| 4927 | } | ||
| 4928 | |||
| 4929 | ✗ | int32_t OnSaveZCConfig() | |
| 4930 | { | ||
| 4931 | ✗ | if(jwin_alert3( | |
| 4932 | "Save Configuration", | ||
| 4933 | "Are you sure that you wish to save your present configuration settings?", | ||
| 4934 | "This will overwrite your prior settings!", | ||
| 4935 | NULL, | ||
| 4936 | "&Yes", | ||
| 4937 | "&No", | ||
| 4938 | NULL, | ||
| 4939 | 'y', | ||
| 4940 | 'n', | ||
| 4941 | 0, | ||
| 4942 | ✗ | get_zc_font(font_lfont)) == 1) | |
| 4943 | { | ||
| 4944 | ✗ | save_game_configs(); | |
| 4945 | ✗ | return D_O_K; | |
| 4946 | } | ||
| 4947 | ✗ | else return D_O_K; | |
| 4948 | ✗ | } | |
| 4949 | |||
| 4950 | ✗ | int32_t OnnClearQuestDir() | |
| 4951 | { | ||
| 4952 | ✗ | auto current_path = fs::current_path() / "quests"; | |
| 4953 | ✗ | if(jwin_alert3( | |
| 4954 | "Clear Current Directory Cache", | ||
| 4955 | "Are you sure that you wish to reset where ZC Player looks for quests?", | ||
| 4956 | ✗ | fmt::format("The new directory will be: {}", current_path.string()).c_str(), | |
| 4957 | NULL, | ||
| 4958 | "&Yes", | ||
| 4959 | "&No", | ||
| 4960 | NULL, | ||
| 4961 | 'y', | ||
| 4962 | 'n', | ||
| 4963 | 0, | ||
| 4964 | ✗ | get_zc_font(font_lfont)) == 1) | |
| 4965 | { | ||
| 4966 | ✗ | zc_set_config("zeldadx","quest_dir","quests"); | |
| 4967 | ✗ | flush_config_file(); | |
| 4968 | ✗ | strcpy(qstdir,"quests"); | |
| 4969 | #ifdef __EMSCRIPTEN__ | ||
| 4970 | em_sync_fs(); | ||
| 4971 | #endif | ||
| 4972 | ✗ | return D_O_K; | |
| 4973 | } | ||
| 4974 | ✗ | else return D_O_K; | |
| 4975 | ✗ | } | |
| 4976 | |||
| 4977 | ✗ | int32_t onConsole() | |
| 4978 | { | ||
| 4979 | ✗ | if ( !console_enabled ) | |
| 4980 | { | ||
| 4981 | ✗ | AlertDialog("ZC Console", | |
| 4982 | ✗ | "Open the ZC Console?" | |
| 4983 | "\nThis will display any messages logged by scripts," | ||
| 4984 | " including errors.", | ||
| 4985 | ✗ | [&](bool ret,bool) | |
| 4986 | { | ||
| 4987 | ✗ | if(ret) | |
| 4988 | { | ||
| 4989 | ✗ | FFCore.ZScriptConsole(true); | |
| 4990 | ✗ | } | |
| 4991 | ✗ | }).show(); | |
| 4992 | ✗ | return D_O_K; | |
| 4993 | } | ||
| 4994 | else | ||
| 4995 | { | ||
| 4996 | ✗ | FFCore.ZScriptConsole(false); | |
| 4997 | ✗ | return D_O_K; | |
| 4998 | } | ||
| 4999 | ✗ | } | |
| 5000 | |||
| 5001 | ✗ | int32_t onClrConsoleOnReload() | |
| 5002 | { | ||
| 5003 | ✗ | clearConsoleOnReload = !clearConsoleOnReload; | |
| 5004 | ✗ | zc_set_config("CONSOLE","clear_console_on_reload",clearConsoleOnReload?1:0); | |
| 5005 | ✗ | return D_O_K; | |
| 5006 | } | ||
| 5007 | ✗ | int32_t onClrConsoleOnLoad() | |
| 5008 | { | ||
| 5009 | ✗ | clearConsoleOnLoad = !clearConsoleOnLoad; | |
| 5010 | ✗ | zc_set_config("CONSOLE","clear_console_on_load",clearConsoleOnLoad?1:0); | |
| 5011 | ✗ | return D_O_K; | |
| 5012 | } | ||
| 5013 | |||
| 5014 | |||
| 5015 | ✗ | int32_t onFrameSkip() | |
| 5016 | { | ||
| 5017 | ✗ | FrameSkip = !FrameSkip; | |
| 5018 | ✗ | return D_O_K; | |
| 5019 | } | ||
| 5020 | |||
| 5021 | ✗ | int32_t onSaveDragResize() | |
| 5022 | { | ||
| 5023 | ✗ | SaveDragResize = !SaveDragResize; | |
| 5024 | ✗ | zc_set_config(cfg_sect,"save_drag_resize",(int32_t)SaveDragResize); | |
| 5025 | ✗ | return D_O_K; | |
| 5026 | } | ||
| 5027 | |||
| 5028 | ✗ | int32_t onDragAspect() | |
| 5029 | { | ||
| 5030 | ✗ | DragAspect = !DragAspect; | |
| 5031 | ✗ | zc_set_config(cfg_sect,"drag_aspect",(int32_t)DragAspect); | |
| 5032 | ✗ | return D_O_K; | |
| 5033 | } | ||
| 5034 | |||
| 5035 | ✗ | int32_t onTransLayers() | |
| 5036 | { | ||
| 5037 | ✗ | TransLayers = !TransLayers; | |
| 5038 | ✗ | zc_set_config(cfg_sect,"translayers",(int32_t)TransLayers); | |
| 5039 | ✗ | return D_O_K; | |
| 5040 | } | ||
| 5041 | |||
| 5042 | ✗ | int32_t onNESquit() | |
| 5043 | { | ||
| 5044 | ✗ | NESquit = !NESquit; | |
| 5045 | ✗ | zc_set_config(cfg_sect,"fastquit",(int32_t)NESquit); | |
| 5046 | ✗ | return D_O_K; | |
| 5047 | } | ||
| 5048 | |||
| 5049 | ✗ | int32_t onVolKeys() | |
| 5050 | { | ||
| 5051 | ✗ | volkeys = !volkeys; | |
| 5052 | ✗ | zc_set_config(sfx_sect,"volkeys",(int32_t)volkeys); | |
| 5053 | ✗ | return D_O_K; | |
| 5054 | } | ||
| 5055 | |||
| 5056 | ✗ | int32_t onShowFPS() | |
| 5057 | { | ||
| 5058 | ✗ | ShowFPS = !ShowFPS; | |
| 5059 | ✗ | zc_set_config(cfg_sect,"showfps",(int32_t)ShowFPS); | |
| 5060 | ✗ | return D_O_K; | |
| 5061 | } | ||
| 5062 | |||
| 5063 | ✗ | int32_t onShowTime() | |
| 5064 | { | ||
| 5065 | ✗ | ShowGameTime = !ShowGameTime; | |
| 5066 | ✗ | zc_set_config(cfg_sect,"showtime",ShowGameTime); | |
| 5067 | ✗ | return D_O_K; | |
| 5068 | } | ||
| 5069 | |||
| 5070 | 2162387288 | bool is_Fkey(int32_t k) | |
| 5071 | { | ||
| 5072 |
2/2✓ Branch 0 taken 219903792 times.
✓ Branch 1 taken 1942483496 times.
|
2162387288 | switch(k) |
| 5073 | { | ||
| 5074 | case KEY_F1: | ||
| 5075 | case KEY_F2: | ||
| 5076 | case KEY_F3: | ||
| 5077 | case KEY_F4: | ||
| 5078 | case KEY_F5: | ||
| 5079 | case KEY_F6: | ||
| 5080 | case KEY_F7: | ||
| 5081 | case KEY_F8: | ||
| 5082 | case KEY_F9: | ||
| 5083 | case KEY_F10: | ||
| 5084 | case KEY_F11: | ||
| 5085 | case KEY_F12: | ||
| 5086 | 219903792 | return true; | |
| 5087 | } | ||
| 5088 | |||
| 5089 | 1942483496 | return false; | |
| 5090 | 2162387288 | } | |
| 5091 | |||
| 5092 | void kb_getkey(DIALOG *d); | ||
| 5093 | |||
| 5094 | //Used by all keyboard key settings dialogues. | ||
| 5095 | ✗ | void kb_clearjoystick(DIALOG *d) | |
| 5096 | { | ||
| 5097 | ✗ | d->flags|=D_SELECTED; | |
| 5098 | |||
| 5099 | ✗ | jwin_button_proc(MSG_DRAW,d,0); | |
| 5100 | ✗ | jwin_draw_win(screen, (screen->w-160)/2, (screen->h-48)/2, 160, 48, FR_WIN); | |
| 5101 | // text_mode(vc(11)); | ||
| 5102 | ✗ | textout_centre_ex(screen, font, "Press any key to clear", gui_bmp->w/2, gui_bmp->h/2 - 8, jwin_pal[jcBOXFG],jwin_pal[jcBOX]); | |
| 5103 | ✗ | textout_centre_ex(screen, font, "ESC to cancel", gui_bmp->w/2, gui_bmp->h/2, jwin_pal[jcBOXFG],jwin_pal[jcBOX]); | |
| 5104 | |||
| 5105 | ✗ | update_hw_screen(); | |
| 5106 | |||
| 5107 | ✗ | clear_keybuf(); | |
| 5108 | ✗ | int32_t k = next_press_key(); | |
| 5109 | ✗ | clear_keybuf(); | |
| 5110 | |||
| 5111 | //shnarf | ||
| 5112 | //47=f1 | ||
| 5113 | //59=esc | ||
| 5114 | // if(k>0 && k<123 && !((k>46)&&(k<60))) | ||
| 5115 | // *((int32_t*)d->dp3) = k; | ||
| 5116 | ✗ | if ( k != 59 ) *((int32_t*)d->dp3) = 0; | |
| 5117 | |||
| 5118 | |||
| 5119 | ✗ | d->flags&=~D_SELECTED; | |
| 5120 | ✗ | } | |
| 5121 | |||
| 5122 | //Clears key to 0. | ||
| 5123 | //Used by all keyboard key settings dialogues. | ||
| 5124 | void kb_clearkey(DIALOG *d); | ||
| 5125 | |||
| 5126 | ✗ | int32_t d_j_clearbutton_proc(int32_t msg,DIALOG *d,int32_t c) | |
| 5127 | { | ||
| 5128 | ✗ | switch(msg) | |
| 5129 | { | ||
| 5130 | case MSG_KEY: | ||
| 5131 | case MSG_CLICK: | ||
| 5132 | |||
| 5133 | ✗ | kb_clearjoystick(d); | |
| 5134 | |||
| 5135 | ✗ | while(gui_mouse_b()) | |
| 5136 | { | ||
| 5137 | ✗ | clear_keybuf(); | |
| 5138 | ✗ | rest(1); | |
| 5139 | } | ||
| 5140 | |||
| 5141 | ✗ | return D_REDRAW; | |
| 5142 | } | ||
| 5143 | |||
| 5144 | ✗ | return jwin_button_proc(msg,d,c); | |
| 5145 | ✗ | } | |
| 5146 | |||
| 5147 | int32_t d_kbutton_proc(int32_t msg,DIALOG *d,int32_t c); | ||
| 5148 | //Only used in keyboard settings dialogues to clear keys. | ||
| 5149 | int32_t d_k_clearbutton_proc(int32_t msg,DIALOG *d,int32_t c); | ||
| 5150 | |||
| 5151 | ✗ | int32_t j_getbtn(DIALOG *d) | |
| 5152 | { | ||
| 5153 | ✗ | d->flags|=D_SELECTED; | |
| 5154 | ✗ | jwin_button_proc(MSG_DRAW,d,0); | |
| 5155 | ✗ | jwin_draw_win(screen, (screen->w-160)/2, (screen->h-48)/2, 160, 48, FR_WIN); | |
| 5156 | // text_mode(vc(11)); | ||
| 5157 | ✗ | int32_t y = screen->h/2 - 12; | |
| 5158 | ✗ | textout_centre_ex(screen, font, "Press a button", screen->w/2, y, jwin_pal[jcBOXFG],jwin_pal[jcBOX]); | |
| 5159 | ✗ | textout_centre_ex(screen, font, "ESC to cancel", screen->w/2, y+8, jwin_pal[jcBOXFG],jwin_pal[jcBOX]); | |
| 5160 | ✗ | textout_centre_ex(screen, font, "SPACE to disable", screen->w/2, y+16, jwin_pal[jcBOXFG],jwin_pal[jcBOX]); | |
| 5161 | |||
| 5162 | ✗ | update_hw_screen(); | |
| 5163 | |||
| 5164 | ✗ | int32_t b = next_joy_input(true); | |
| 5165 | ✗ | if (b == -2) | |
| 5166 | ✗ | return D_CLOSE; | |
| 5167 | |||
| 5168 | ✗ | if(b>=0) | |
| 5169 | ✗ | *((int32_t*)d->dp3) = b; | |
| 5170 | |||
| 5171 | ✗ | d->flags&=~D_SELECTED; | |
| 5172 | |||
| 5173 | ✗ | return D_O_K; | |
| 5174 | ✗ | } | |
| 5175 | |||
| 5176 | ✗ | void j_getstick(DIALOG *d) | |
| 5177 | { | ||
| 5178 | ✗ | d->flags|=D_SELECTED; | |
| 5179 | ✗ | jwin_button_proc(MSG_DRAW,d,0); | |
| 5180 | ✗ | jwin_draw_win(screen, (screen->w-160)/2, (screen->h-48)/2, 160, 48, FR_WIN); | |
| 5181 | // text_mode(vc(11)); | ||
| 5182 | ✗ | int32_t y = screen->h/2 - 12; | |
| 5183 | ✗ | textout_centre_ex(screen, font, "Move a stick (or DPAD)", screen->w/2, y, jwin_pal[jcBOXFG],jwin_pal[jcBOX]); | |
| 5184 | ✗ | textout_centre_ex(screen, font, "ESC to cancel", screen->w/2, y+8, jwin_pal[jcBOXFG],jwin_pal[jcBOX]); | |
| 5185 | ✗ | textout_centre_ex(screen, font, "SPACE to disable", screen->w/2, y+16, jwin_pal[jcBOXFG],jwin_pal[jcBOX]); | |
| 5186 | |||
| 5187 | ✗ | update_hw_screen(); | |
| 5188 | |||
| 5189 | ✗ | int32_t b = next_joy_input(false); | |
| 5190 | |||
| 5191 | ✗ | if(b>=0) | |
| 5192 | ✗ | *((int32_t*)d->dp3) = b; | |
| 5193 | |||
| 5194 | ✗ | d->flags&=~D_SELECTED; | |
| 5195 | ✗ | } | |
| 5196 | |||
| 5197 | ✗ | int32_t d_jbutton_proc(int32_t msg,DIALOG *d,int32_t c) | |
| 5198 | { | ||
| 5199 | ✗ | switch(msg) | |
| 5200 | { | ||
| 5201 | case MSG_KEY: | ||
| 5202 | case MSG_CLICK: | ||
| 5203 | |||
| 5204 | ✗ | int ret = j_getbtn(d); | |
| 5205 | ✗ | if (ret != D_O_K) | |
| 5206 | ✗ | return ret; | |
| 5207 | |||
| 5208 | ✗ | while(gui_mouse_b()) { | |
| 5209 | ✗ | rest(1); | |
| 5210 | ✗ | clear_keybuf(); | |
| 5211 | } | ||
| 5212 | |||
| 5213 | ✗ | return D_REDRAW; | |
| 5214 | } | ||
| 5215 | |||
| 5216 | ✗ | return jwin_button_proc(msg,d,c); | |
| 5217 | ✗ | } | |
| 5218 | |||
| 5219 | ✗ | int32_t d_jstick_proc(int32_t msg,DIALOG *d,int32_t c) | |
| 5220 | { | ||
| 5221 | ✗ | switch(msg) | |
| 5222 | { | ||
| 5223 | case MSG_KEY: | ||
| 5224 | case MSG_CLICK: | ||
| 5225 | |||
| 5226 | ✗ | j_getstick(d); | |
| 5227 | |||
| 5228 | ✗ | while(gui_mouse_b()) { | |
| 5229 | ✗ | rest(1); | |
| 5230 | ✗ | clear_keybuf(); | |
| 5231 | } | ||
| 5232 | |||
| 5233 | ✗ | return D_REDRAW; | |
| 5234 | } | ||
| 5235 | |||
| 5236 | ✗ | return jwin_button_proc(msg,d,c); | |
| 5237 | ✗ | } | |
| 5238 | |||
| 5239 | //shnarf | ||
| 5240 | extern const char *key_str[]; | ||
| 5241 | std::string get_keystr(int key); | ||
| 5242 | |||
| 5243 | const char *pan_str[4] = { " MONO", " 1/2", " 3/4", " FULL" }; | ||
| 5244 | |||
| 5245 | static char str_a[80],str_b[80],str_s[80],str_m[80],str_l[80],str_r[80],str_p[80],str_ex1[80],str_ex2[80],str_ex3[80],str_ex4[80], | ||
| 5246 | str_leftmod1[80],str_leftmod2[80],str_rightmod1[80],str_rightmod2[80], str_left[80], str_right[80], str_up[80], str_down[80], | ||
| 5247 | str_primary_stick[80], str_secondary_stick[80]; | ||
| 5248 | |||
| 5249 | ✗ | int32_t d_stringloader(int32_t msg,DIALOG *d,int32_t c) | |
| 5250 | { | ||
| 5251 | //these are here to bypass compiler warnings about unused arguments | ||
| 5252 | ✗ | c=c; | |
| 5253 | |||
| 5254 | ✗ | if (d->w == 1) | |
| 5255 | { | ||
| 5256 | ✗ | if (!gamepad_dlg_cur_joystick || !al_get_joystick_active(gamepad_dlg_cur_joystick)) | |
| 5257 | { | ||
| 5258 | ✗ | InfoDialog("ZC", "Invalid gamepad. Did it disconnect?").show(); | |
| 5259 | ✗ | return D_CLOSE; | |
| 5260 | } | ||
| 5261 | ✗ | } | |
| 5262 | |||
| 5263 | ✗ | if(msg==MSG_DRAW) | |
| 5264 | { | ||
| 5265 | ✗ | switch(d->w) | |
| 5266 | { | ||
| 5267 | case 0: | ||
| 5268 | ✗ | sprintf(str_a,"%03d\n%s",Akey,key_str[Akey]); | |
| 5269 | ✗ | sprintf(str_b,"%03d\n%s",Bkey,key_str[Bkey]); | |
| 5270 | ✗ | sprintf(str_s,"%03d\n%s",Skey,key_str[Skey]); | |
| 5271 | ✗ | sprintf(str_l,"%03d\n%s",Lkey,key_str[Lkey]); | |
| 5272 | ✗ | sprintf(str_r,"%03d\n%s",Rkey,key_str[Rkey]); | |
| 5273 | ✗ | sprintf(str_p,"%03d\n%s",Pkey,key_str[Pkey]); | |
| 5274 | ✗ | sprintf(str_ex1,"%03d\n%s",Exkey1,key_str[Exkey1]); | |
| 5275 | ✗ | sprintf(str_ex2,"%03d\n%s",Exkey2,key_str[Exkey2]); | |
| 5276 | ✗ | sprintf(str_ex3,"%03d\n%s",Exkey3,key_str[Exkey3]); | |
| 5277 | ✗ | sprintf(str_ex4,"%03d\n%s",Exkey4,key_str[Exkey4]); | |
| 5278 | ✗ | sprintf(str_up,"%03d\n%s",DUkey,key_str[DUkey]); | |
| 5279 | ✗ | sprintf(str_down,"%03d\n%s",DDkey,key_str[DDkey]); | |
| 5280 | ✗ | sprintf(str_left,"%03d\n%s",DLkey,key_str[DLkey]); | |
| 5281 | ✗ | sprintf(str_right,"%03d\n%s",DRkey,key_str[DRkey]); | |
| 5282 | ✗ | sprintf(str_leftmod1,"%03d\n%s",cheat_modifier_keys[0],key_str[cheat_modifier_keys[0]]); | |
| 5283 | ✗ | sprintf(str_leftmod2,"%03d\n%s",cheat_modifier_keys[1],key_str[cheat_modifier_keys[1]]); | |
| 5284 | ✗ | sprintf(str_rightmod1,"%03d\n%s",cheat_modifier_keys[2],key_str[cheat_modifier_keys[2]]); | |
| 5285 | ✗ | sprintf(str_rightmod2,"%03d\n%s",cheat_modifier_keys[3],key_str[cheat_modifier_keys[3]]); | |
| 5286 | ✗ | break; | |
| 5287 | |||
| 5288 | case 1: | ||
| 5289 | ✗ | sprintf(str_a,"%03d\n%s",Abtn,joybtn_name(Abtn)); | |
| 5290 | ✗ | sprintf(str_b,"%03d\n%s",Bbtn,joybtn_name(Bbtn)); | |
| 5291 | ✗ | sprintf(str_s,"%03d\n%s",Sbtn,joybtn_name(Sbtn)); | |
| 5292 | ✗ | sprintf(str_l,"%03d\n%s",Lbtn,joybtn_name(Lbtn)); | |
| 5293 | ✗ | sprintf(str_r,"%03d\n%s",Rbtn,joybtn_name(Rbtn)); | |
| 5294 | ✗ | sprintf(str_m,"%03d\n%s",Mbtn,joybtn_name(Mbtn)); | |
| 5295 | ✗ | sprintf(str_p,"%03d\n%s",Pbtn,joybtn_name(Pbtn)); | |
| 5296 | ✗ | sprintf(str_ex1,"%03d\n%s",Exbtn1,joybtn_name(Exbtn1)); | |
| 5297 | ✗ | sprintf(str_ex2,"%03d\n%s",Exbtn2,joybtn_name(Exbtn2)); | |
| 5298 | ✗ | sprintf(str_ex3,"%03d\n%s",Exbtn3,joybtn_name(Exbtn3)); | |
| 5299 | ✗ | sprintf(str_ex4,"%03d\n%s",Exbtn4,joybtn_name(Exbtn4)); | |
| 5300 | ✗ | sprintf(str_up,"%03d\n%s",DUbtn,joybtn_name(DUbtn)); | |
| 5301 | ✗ | sprintf(str_down,"%03d\n%s",DDbtn,joybtn_name(DDbtn)); | |
| 5302 | ✗ | sprintf(str_left,"%03d\n%s",DLbtn,joybtn_name(DLbtn)); | |
| 5303 | ✗ | sprintf(str_right,"%03d\n%s",DRbtn,joybtn_name(DRbtn)); | |
| 5304 | ✗ | sprintf(str_primary_stick,"%03d\n%s",js_stick_1_x_stick,joystick_name(js_stick_1_x_stick)); | |
| 5305 | ✗ | sprintf(str_secondary_stick,"%03d\n%s",js_stick_2_x_stick,joystick_name(js_stick_2_x_stick)); | |
| 5306 | ✗ | sprintf(str_leftmod1,"%03d\n%s",cheat_modifier_keys[0],key_str[cheat_modifier_keys[0]]); | |
| 5307 | ✗ | sprintf(str_leftmod2,"%03d\n%s",cheat_modifier_keys[1],key_str[cheat_modifier_keys[1]]); | |
| 5308 | ✗ | sprintf(str_rightmod1,"%03d\n%s",cheat_modifier_keys[2],key_str[cheat_modifier_keys[2]]); | |
| 5309 | ✗ | sprintf(str_rightmod2,"%03d\n%s",cheat_modifier_keys[3],key_str[cheat_modifier_keys[3]]); | |
| 5310 | ✗ | break; | |
| 5311 | |||
| 5312 | case 2: | ||
| 5313 | ✗ | sprintf(str_a," %3d",midi_volume); | |
| 5314 | ✗ | sprintf(str_l," %3d",emusic_volume); | |
| 5315 | ✗ | sprintf(str_r," %3d",sfx_volume); | |
| 5316 | ✗ | strcpy(str_s,pan_str[pan_style]); | |
| 5317 | ✗ | sprintf(str_leftmod1,"%3d\n%s",cheat_modifier_keys[0],key_str[cheat_modifier_keys[0]]); | |
| 5318 | ✗ | sprintf(str_leftmod2,"%3d\n%s",cheat_modifier_keys[1],key_str[cheat_modifier_keys[1]]); | |
| 5319 | ✗ | sprintf(str_rightmod1,"%3d\n%s",cheat_modifier_keys[2],key_str[cheat_modifier_keys[2]]); | |
| 5320 | ✗ | sprintf(str_rightmod2,"%3d\n%s",cheat_modifier_keys[3],key_str[cheat_modifier_keys[3]]); | |
| 5321 | ✗ | break; | |
| 5322 | } | ||
| 5323 | ✗ | } | |
| 5324 | |||
| 5325 | ✗ | return D_O_K; | |
| 5326 | ✗ | } | |
| 5327 | |||
| 5328 | ✗ | int32_t set_vol(void *dp3, int32_t d2) | |
| 5329 | { | ||
| 5330 | ✗ | switch(((int32_t*)dp3)[0]) | |
| 5331 | { | ||
| 5332 | case 0: | ||
| 5333 | ✗ | midi_volume = zc_min(d2<<3,255); | |
| 5334 | ✗ | break; | |
| 5335 | |||
| 5336 | case 1: | ||
| 5337 | ✗ | digi_volume = zc_min(d2<<3,255); | |
| 5338 | ✗ | break; | |
| 5339 | |||
| 5340 | case 2: | ||
| 5341 | ✗ | emusic_volume = zc_min(d2<<3,255); | |
| 5342 | ✗ | break; | |
| 5343 | |||
| 5344 | case 3: | ||
| 5345 | ✗ | sfx_volume = zc_min(d2<<3,255); | |
| 5346 | ✗ | break; | |
| 5347 | } | ||
| 5348 | |||
| 5349 | // text_mode(vc(11)); | ||
| 5350 | ✗ | textprintf_right_ex(screen,get_zc_font(font_lfont_l), ((int32_t*)dp3)[1],((int32_t*)dp3)[2],jwin_pal[jcBOXFG],jwin_pal[jcBOX]," %3d",zc_min(d2<<3,255)); | |
| 5351 | ✗ | return D_O_K; | |
| 5352 | } | ||
| 5353 | |||
| 5354 | ✗ | int32_t set_pan(void *dp3, int32_t d2) | |
| 5355 | { | ||
| 5356 | ✗ | pan_style = vbound(d2,0,3); | |
| 5357 | // text_mode(vc(11)); | ||
| 5358 | ✗ | textout_right_ex(screen,get_zc_font(font_lfont_l), pan_str[pan_style],((int32_t*)dp3)[1],((int32_t*)dp3)[2],jwin_pal[jcBOXFG],jwin_pal[jcBOX]); | |
| 5359 | ✗ | return D_O_K; | |
| 5360 | } | ||
| 5361 | |||
| 5362 | static int32_t gamepad_joys_list[] = | ||
| 5363 | { | ||
| 5364 | 61, | ||
| 5365 | -1 | ||
| 5366 | }; | ||
| 5367 | |||
| 5368 | static int32_t gamepad_btn_list[] = | ||
| 5369 | { | ||
| 5370 | 6, | ||
| 5371 | 7,8,9,10,11,12,13,14,15,16,17, | ||
| 5372 | 18,19,20,21,22,23,24,25,26,27,28, | ||
| 5373 | 29,30,31,32,33,34,35,36,37,38,39, | ||
| 5374 | -1 | ||
| 5375 | }; | ||
| 5376 | |||
| 5377 | static int32_t gamepad_dirs_list[] = | ||
| 5378 | { | ||
| 5379 | 40,41,42,43, | ||
| 5380 | 44,45,46,47, | ||
| 5381 | 48,49,50,51, | ||
| 5382 | 52,53,54,55, | ||
| 5383 | 56,57,58,59, | ||
| 5384 | 60, | ||
| 5385 | -1 | ||
| 5386 | }; | ||
| 5387 | |||
| 5388 | static TABPANEL gamepad_tabs[] = | ||
| 5389 | { | ||
| 5390 | // (text) | ||
| 5391 | { (char *)"Controllers", D_SELECTED, gamepad_joys_list, 0, NULL }, | ||
| 5392 | { (char *)"Buttons", 0, gamepad_btn_list, 0, NULL }, | ||
| 5393 | { (char *)"Directions", 0, gamepad_dirs_list, 0, NULL }, | ||
| 5394 | { NULL, 0, NULL, 0, NULL } | ||
| 5395 | }; | ||
| 5396 | |||
| 5397 | ✗ | const char *joy_list(int32_t index, int32_t *list_size) | |
| 5398 | { | ||
| 5399 | ✗ | if (index == -1) | |
| 5400 | { | ||
| 5401 | ✗ | *list_size = al_get_num_joysticks(); | |
| 5402 | ✗ | return NULL; | |
| 5403 | } | ||
| 5404 | |||
| 5405 | ✗ | ALLEGRO_JOYSTICK* joy = al_get_joystick(index); | |
| 5406 | ✗ | if (!joy) | |
| 5407 | { | ||
| 5408 | ✗ | return "?"; | |
| 5409 | } | ||
| 5410 | |||
| 5411 | ✗ | return al_get_joystick_name(joy); | |
| 5412 | ✗ | } | |
| 5413 | |||
| 5414 | 356 | static ListData joy__list(joy_list, &font); | |
| 5415 | |||
| 5416 | ✗ | static int32_t d_joylist_proc(int32_t msg,DIALOG *d,int32_t c) | |
| 5417 | { | ||
| 5418 | ✗ | int32_t d2 = d->d2; | |
| 5419 | ✗ | int32_t ret = jwin_droplist_proc(msg,d,c); | |
| 5420 | |||
| 5421 | ✗ | if(d2!=d->d2) | |
| 5422 | { | ||
| 5423 | ✗ | joystick_index = d->d2; | |
| 5424 | ✗ | ret |= D_REDRAW_ALL; | |
| 5425 | ✗ | } | |
| 5426 | |||
| 5427 | ✗ | return ret; | |
| 5428 | } | ||
| 5429 | |||
| 5430 | static DIALOG gamepad_dlg[] = | ||
| 5431 | { | ||
| 5432 | // (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) | ||
| 5433 | { jwin_win_proc, 8, 24, 304, 256, 0, 0, 0, D_EXIT, 0, 0, (void *) "Gamepad Controls", NULL, NULL }, | ||
| 5434 | { jwin_tab_proc, 8+4, 24+23,304-8,256-52,vc(0), vc(15), 0, 0, 0, 0, (void *) gamepad_tabs, NULL, (void *)gamepad_dlg }, | ||
| 5435 | { d_stringloader, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 5436 | { d_timer_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 5437 | { jwin_button_proc, 90, 254, 61, 21, 0, 0, 0, D_EXIT, 0, 0, (void *) "OK", NULL, NULL }, | ||
| 5438 | { jwin_button_proc, 170, 254, 61, 21, 0, 0, 0, D_EXIT, 0, 0, (void *) "Cancel", NULL, NULL }, | ||
| 5439 | // 6 | ||
| 5440 | { d_dummy_proc, 14, 61, 294, 192, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5441 | // 7 | ||
| 5442 | { jwin_ctext_proc, 92, 92-20, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_a, NULL, NULL }, | ||
| 5443 | { jwin_ctext_proc, 92, 120-20, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_b, NULL, NULL }, | ||
| 5444 | { jwin_ctext_proc, 92, 148-20, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_s, NULL, NULL }, | ||
| 5445 | { jwin_ctext_proc, 92, 180-20, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_ex1, NULL, NULL }, | ||
| 5446 | { jwin_ctext_proc, 92, 212-20, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_ex3, NULL, NULL }, | ||
| 5447 | { jwin_ctext_proc, 237, 92-20, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_l, NULL, NULL }, | ||
| 5448 | { jwin_ctext_proc, 237, 120-20, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_r, NULL, NULL }, | ||
| 5449 | { jwin_ctext_proc, 237, 148-20, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_p, NULL, NULL }, | ||
| 5450 | { jwin_ctext_proc, 237, 180-20, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_ex2, NULL, NULL }, | ||
| 5451 | { jwin_ctext_proc, 237, 212-20, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_ex4, NULL, NULL }, | ||
| 5452 | { jwin_ctext_proc, 92, 244-20, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_m, NULL, NULL }, | ||
| 5453 | // 18 | ||
| 5454 | { d_jbutton_proc, 22, 90-20, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "A", NULL, &Abtn}, | ||
| 5455 | { d_jbutton_proc, 22, 118-20, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "B", NULL, &Bbtn}, | ||
| 5456 | { d_jbutton_proc, 22, 146-20, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Start", NULL, &Sbtn}, | ||
| 5457 | { d_jbutton_proc, 22, 178-20, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "X (EX1)", NULL, &Exbtn1}, | ||
| 5458 | { d_jbutton_proc, 22, 210-20, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "EX3", NULL, &Exbtn3}, | ||
| 5459 | { d_jbutton_proc, 167, 90-20, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "L", NULL, &Lbtn}, | ||
| 5460 | { d_jbutton_proc, 167, 118-20, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "R", NULL, &Rbtn}, | ||
| 5461 | { d_jbutton_proc, 167, 146-20, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Map", NULL, &Pbtn}, | ||
| 5462 | { d_jbutton_proc, 167, 178-20, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Y (EX2)", NULL, &Exbtn2}, | ||
| 5463 | { d_jbutton_proc, 167, 210-20, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "EX4", NULL, &Exbtn4}, | ||
| 5464 | { d_jbutton_proc, 22, 242-20, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Menu", NULL, &Mbtn}, | ||
| 5465 | // 29 | ||
| 5466 | { d_j_clearbutton_proc, 22+91, 90-20, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Abtn}, | ||
| 5467 | { d_j_clearbutton_proc, 22+91, 118-20, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Bbtn}, | ||
| 5468 | { d_j_clearbutton_proc, 22+91, 146-20, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Sbtn}, | ||
| 5469 | { d_j_clearbutton_proc, 22+91, 178-20, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Exbtn1}, | ||
| 5470 | { d_j_clearbutton_proc, 22+91, 210-20, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Exbtn3}, | ||
| 5471 | { d_j_clearbutton_proc, 167+91, 90-20, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Lbtn}, | ||
| 5472 | { d_j_clearbutton_proc, 167+91, 118-20, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Rbtn}, | ||
| 5473 | { d_j_clearbutton_proc, 167+91, 146-20, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Pbtn}, | ||
| 5474 | { d_j_clearbutton_proc, 167+91, 178-20, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Exbtn2}, | ||
| 5475 | { d_j_clearbutton_proc, 167+91, 210-20, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Exbtn4}, | ||
| 5476 | { d_j_clearbutton_proc, 22+91, 242-20, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Mbtn}, | ||
| 5477 | // 40 | ||
| 5478 | { jwin_frame_proc, 14, 62, 147, 80, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5479 | { jwin_frame_proc, 159, 62, 147, 80, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5480 | { jwin_text_proc, 30, 68, 160, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Vertical", NULL, NULL }, | ||
| 5481 | { jwin_text_proc, 175, 68, 160, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Horizontal", NULL, NULL }, | ||
| 5482 | // 44 | ||
| 5483 | { jwin_text_proc, 92, 84, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_up, NULL, NULL }, | ||
| 5484 | { jwin_text_proc, 92, 112, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_down, NULL, NULL }, | ||
| 5485 | { jwin_text_proc, 237, 84, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_left, NULL, NULL }, | ||
| 5486 | { jwin_text_proc, 237, 112, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_right, NULL, NULL }, | ||
| 5487 | // 48 | ||
| 5488 | { d_jbutton_proc, 22, 82, 61, 21, vc(14), vc(11), 0, 0, 0, 0, (void *) "Up", NULL, &DUbtn }, | ||
| 5489 | { d_jbutton_proc, 22, 110, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Down", NULL, &DDbtn }, | ||
| 5490 | { d_jbutton_proc, 167, 82, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Left", NULL, &DLbtn }, | ||
| 5491 | { d_jbutton_proc, 167, 110, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Right", NULL, &DRbtn }, | ||
| 5492 | // 52 | ||
| 5493 | { d_j_clearbutton_proc, 22+91, 82, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &DUbtn}, | ||
| 5494 | { d_j_clearbutton_proc, 22+91, 110, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &DDbtn}, | ||
| 5495 | { d_j_clearbutton_proc, 167+91, 82, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &DLbtn}, | ||
| 5496 | { d_j_clearbutton_proc, 167+91, 110, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &DRbtn}, | ||
| 5497 | // 56 | ||
| 5498 | { jwin_check_proc, 22, 150, 147, 8, vc(14), vc(1), 0, 0, 1, 0, (void *) "Primary: Use Analog Stick (Ignore above and use below instead)", NULL, NULL }, | ||
| 5499 | { d_jstick_proc, 22, 165, 61, 21, vc(14), vc(11), 0, 0, 0, 0, (void *) "Primary", NULL, &js_stick_1_x_stick }, | ||
| 5500 | { d_jstick_proc, 22, 195, 61, 21, vc(14), vc(11), 0, 0, 0, 0, (void *) "Secondary", NULL, &js_stick_2_x_stick }, | ||
| 5501 | { jwin_text_proc, 90, 165, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_primary_stick, NULL, NULL }, | ||
| 5502 | { jwin_text_proc, 90, 195, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_secondary_stick, NULL, NULL }, | ||
| 5503 | |||
| 5504 | // 61 | ||
| 5505 | { d_joylist_proc, 22, 62, 150, 16, 0, 0, 0, 0, 0, 0, (void *) &joy__list, NULL, NULL }, | ||
| 5506 | |||
| 5507 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } | ||
| 5508 | }; | ||
| 5509 | |||
| 5510 | static int32_t keyboard_keys_list[] = | ||
| 5511 | { | ||
| 5512 | 6,7,8,9,10, | ||
| 5513 | 11,12,13,14,15,16,17,18,19,20, | ||
| 5514 | 21,22,23,24,25,26,27,28,29,30, | ||
| 5515 | 31,32,33,34,35,36,37,38,39,40, | ||
| 5516 | -1 | ||
| 5517 | }; | ||
| 5518 | |||
| 5519 | static int32_t keyboard_dirs_list[] = | ||
| 5520 | { | ||
| 5521 | 41,42,43,44, | ||
| 5522 | 45,46,47,48, | ||
| 5523 | 49,50,51,52, | ||
| 5524 | 53,54,55,56, | ||
| 5525 | -1 | ||
| 5526 | }; | ||
| 5527 | |||
| 5528 | static int32_t keyboard_mods_list[] = | ||
| 5529 | { | ||
| 5530 | 57,58,59,60, | ||
| 5531 | 61,62,63,64, | ||
| 5532 | 65,66,67,68, | ||
| 5533 | 69,70,71,72, | ||
| 5534 | -1 | ||
| 5535 | }; | ||
| 5536 | |||
| 5537 | static TABPANEL keyboard_control_tabs[] = | ||
| 5538 | { | ||
| 5539 | // (text) | ||
| 5540 | { (char *)"Keys", D_SELECTED, keyboard_keys_list, 0, NULL }, | ||
| 5541 | { (char *)"Directions", 0, keyboard_dirs_list, 0, NULL }, | ||
| 5542 | { (char *)"Cheat Mods", 0, keyboard_mods_list, 0, NULL }, | ||
| 5543 | { NULL, 0, NULL, 0, NULL } | ||
| 5544 | }; | ||
| 5545 | |||
| 5546 | static DIALOG keyboard_control_dlg[] = | ||
| 5547 | { | ||
| 5548 | // (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) | ||
| 5549 | { jwin_win_proc, 8, 39, 304, 240, 0, 0, 0, D_EXIT, 0, 0, (void *) "Keyboard Controls", NULL, NULL }, | ||
| 5550 | { jwin_tab_proc, 8+4, 39+23,304-8,240-56,vc(0), vc(15), 0, 0, 0, 0, (void *) keyboard_control_tabs, NULL, (void *)keyboard_control_dlg }, | ||
| 5551 | { d_stringloader, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 5552 | { jwin_button_proc, 90, 254, 61, 21, 0, 0, 0, D_EXIT, 0, 0, (void *) "OK", NULL, NULL }, | ||
| 5553 | { jwin_button_proc, 170, 254, 61, 21, 0, 0, 0, D_EXIT, 0, 0, (void *) "Cancel", NULL, NULL }, | ||
| 5554 | { d_timer_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 5555 | // Keys | ||
| 5556 | // 6 | ||
| 5557 | { jwin_frame_proc, 14, 80, 148, 105, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5558 | { jwin_frame_proc, 158, 80, 148, 105, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5559 | { jwin_frame_proc, 14, 181, 292, 67, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5560 | { jwin_text_proc, 30, 86, 160, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Standard", NULL, NULL }, | ||
| 5561 | { jwin_text_proc, 175, 86, 160, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Extended", NULL, NULL }, | ||
| 5562 | // 11 | ||
| 5563 | { jwin_text_proc, 92-4, 102, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_a, NULL, NULL }, | ||
| 5564 | { jwin_text_proc, 92-4, 130, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_b, NULL, NULL }, | ||
| 5565 | { jwin_text_proc, 92-4, 158, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_s, NULL, NULL }, | ||
| 5566 | { jwin_text_proc, 92-4, 190, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_ex1, NULL, NULL }, | ||
| 5567 | { jwin_text_proc, 92-4, 222, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_ex3, NULL, NULL }, | ||
| 5568 | { jwin_text_proc, 237-4, 102, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_l, NULL, NULL }, | ||
| 5569 | { jwin_text_proc, 237-4, 130, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_r, NULL, NULL }, | ||
| 5570 | { jwin_text_proc, 237-4, 158, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_p, NULL, NULL }, | ||
| 5571 | { jwin_text_proc, 237-4, 190, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_ex2, NULL, NULL }, | ||
| 5572 | { jwin_text_proc, 237-4, 222, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_ex4, NULL, NULL }, | ||
| 5573 | // 21 | ||
| 5574 | { d_kbutton_proc, 22, 100, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "A", NULL, &Akey}, | ||
| 5575 | { d_kbutton_proc, 22, 128, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "B", NULL, &Bkey}, | ||
| 5576 | { d_kbutton_proc, 22, 156, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Start", NULL, &Skey}, | ||
| 5577 | { d_kbutton_proc, 22, 188, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "X (EX1)", NULL, &Exkey1}, | ||
| 5578 | { d_kbutton_proc, 22, 220, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "EX3", NULL, &Exkey3}, | ||
| 5579 | { d_kbutton_proc, 167, 100, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "L", NULL, &Lkey}, | ||
| 5580 | { d_kbutton_proc, 167, 128, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "R", NULL, &Rkey}, | ||
| 5581 | { d_kbutton_proc, 167, 156, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Map", NULL, &Pkey}, | ||
| 5582 | { d_kbutton_proc, 167, 188, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Y (EX2)", NULL, &Exkey2}, | ||
| 5583 | { d_kbutton_proc, 167, 220, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "EX4", NULL, &Exkey4}, | ||
| 5584 | // 31 | ||
| 5585 | { d_k_clearbutton_proc, 22+91, 100, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Akey}, | ||
| 5586 | { d_k_clearbutton_proc, 22+91, 128, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Bkey}, | ||
| 5587 | { d_k_clearbutton_proc, 22+91, 156, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Skey}, | ||
| 5588 | { d_k_clearbutton_proc, 22+91, 188, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Exkey1}, | ||
| 5589 | { d_k_clearbutton_proc, 22+91, 220, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Exkey3}, | ||
| 5590 | { d_k_clearbutton_proc, 167+91, 100, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Lkey}, | ||
| 5591 | { d_k_clearbutton_proc, 167+91, 128, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Rkey}, | ||
| 5592 | { d_k_clearbutton_proc, 167+91, 156, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Pkey}, | ||
| 5593 | { d_k_clearbutton_proc, 167+91, 188, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Exkey2}, | ||
| 5594 | { d_k_clearbutton_proc, 167+91, 220, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Exkey4}, | ||
| 5595 | // Dirs | ||
| 5596 | // 41 | ||
| 5597 | { jwin_frame_proc, 14, 80, 147, 80, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5598 | { jwin_frame_proc, 159, 80, 147, 80, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5599 | { jwin_text_proc, 30, 86, 160, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Vertical", NULL, NULL }, | ||
| 5600 | { jwin_text_proc, 175, 86, 160, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Horizontal", NULL, NULL }, | ||
| 5601 | // 45 | ||
| 5602 | { jwin_text_proc, 92-4, 102, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_up, NULL, NULL }, | ||
| 5603 | { jwin_text_proc, 92-4, 130, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_down, NULL, NULL }, | ||
| 5604 | { jwin_text_proc, 237-4, 102, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_left, NULL, NULL }, | ||
| 5605 | { jwin_text_proc, 237-4, 130, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_right, NULL, NULL }, | ||
| 5606 | // 49 | ||
| 5607 | { d_kbutton_proc, 22, 100, 61, 21, vc(14), vc(11), 0, 0, 0, 0, (void *) "Up", NULL, &DUkey}, | ||
| 5608 | { d_kbutton_proc, 22, 128, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Down", NULL, &DDkey}, | ||
| 5609 | { d_kbutton_proc, 167, 100, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Left", NULL, &DLkey}, | ||
| 5610 | { d_kbutton_proc, 167, 128, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Right", NULL, &DRkey}, | ||
| 5611 | // 53 | ||
| 5612 | { d_k_clearbutton_proc, 22+91, 100, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &DUkey}, | ||
| 5613 | { d_k_clearbutton_proc, 22+91, 128, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &DDkey}, | ||
| 5614 | { d_k_clearbutton_proc, 167+91, 100, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &DLkey}, | ||
| 5615 | { d_k_clearbutton_proc, 167+91, 128, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &DRkey}, | ||
| 5616 | // Mods | ||
| 5617 | // 57 | ||
| 5618 | { jwin_frame_proc, 14, 80, 148, 140-58, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5619 | { jwin_frame_proc, 158, 80, 148, 140-58, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5620 | { jwin_text_proc, 30, 86, 160, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Left", NULL, NULL }, | ||
| 5621 | { jwin_text_proc, 175, 86, 160, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Right", NULL, NULL }, | ||
| 5622 | // 61 | ||
| 5623 | { jwin_text_proc, 92-26, 101, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_leftmod1, NULL, NULL }, | ||
| 5624 | { jwin_text_proc, 92-26, 129, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_rightmod1, NULL, NULL }, | ||
| 5625 | { jwin_text_proc, 237-4-22,101, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_leftmod2, NULL, NULL }, | ||
| 5626 | { jwin_text_proc, 237-4-22,129, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_rightmod2, NULL, NULL }, | ||
| 5627 | // 65 | ||
| 5628 | { d_kbutton_proc, 22, 100, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Main", NULL, &cheat_modifier_keys[0]}, | ||
| 5629 | { d_kbutton_proc, 22, 128, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Second", NULL, &cheat_modifier_keys[2]}, | ||
| 5630 | { d_kbutton_proc, 167, 100, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Main", NULL, &cheat_modifier_keys[1]}, | ||
| 5631 | { d_kbutton_proc, 167, 128, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Second", NULL, &cheat_modifier_keys[3]}, | ||
| 5632 | // 69 | ||
| 5633 | { d_k_clearbutton_proc, 22+91, 100, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &cheat_modifier_keys[0]}, | ||
| 5634 | { d_k_clearbutton_proc, 22+91, 128, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &cheat_modifier_keys[2]}, | ||
| 5635 | { d_k_clearbutton_proc, 167+91, 100, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &cheat_modifier_keys[1]}, | ||
| 5636 | { d_k_clearbutton_proc, 167+91, 128, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &cheat_modifier_keys[3]}, | ||
| 5637 | // 73 | ||
| 5638 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } | ||
| 5639 | }; | ||
| 5640 | |||
| 5641 | int32_t midi_dp[3] = {0,0,0}; | ||
| 5642 | int32_t emus_dp[3] = {2,0,0}; | ||
| 5643 | int32_t sfx_dp[3] = {3,0,0}; | ||
| 5644 | int32_t pan_dp[3] = {0,0,0}; | ||
| 5645 | |||
| 5646 | static DIALOG sound_dlg[] = | ||
| 5647 | { | ||
| 5648 | //(dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) | ||
| 5649 | 356 | { jwin_win_proc, 0, 0, 320, 178, 0, 0, 0, D_EXIT, 0, 0, (void *) "Sound Settings", NULL, NULL }, | |
| 5650 | 356 | { d_stringloader, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5651 | 356 | { jwin_button_proc, 58, 148, 61, 21, 0, 0, 0, D_EXIT, 0, 0, (void *) "OK", NULL, NULL }, | |
| 5652 | 356 | { jwin_button_proc, 138, 148, 61, 21, 0, 0, 0, D_EXIT, 0, 0, (void *) "Cancel", NULL, NULL }, | |
| 5653 | 356 | { d_timer_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5654 | 356 | { jwin_frame_proc, 10, 28, 300, 112, 0, 0, 0, 0, FR_ETCHED, 0, NULL, NULL, NULL }, | |
| 5655 | 356 | { jwin_rtext_proc, 190, 40, 40, 8, vc(7), vc(11), 0, 0, 0, 0, (void *) str_a, NULL, NULL }, | |
| 5656 | 356 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5657 | 356 | { jwin_rtext_proc, 190, 56, 40, 8, vc(7), vc(11), 0, 0, 0, 0, (void *) str_l, NULL, NULL }, | |
| 5658 | 356 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5659 | // 10 | ||
| 5660 | 356 | { jwin_rtext_proc, 190, 72, 40, 8, vc(7), vc(11), 0, 0, 0, 0, (void *) str_r, NULL, NULL }, | |
| 5661 | 356 | { jwin_rtext_proc, 190, 88, 40, 8, vc(7), vc(11), 0, 0, 0, 0, (void *) str_s, NULL, NULL }, | |
| 5662 | 356 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5663 | 356 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5664 | 356 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5665 | 356 | { jwin_slider_proc, 196, 40, 96, 8, vc(0), jwin_pal[jcBOX], 0, 0, 32, 0, NULL, (void *) set_vol, midi_dp }, | |
| 5666 | 356 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5667 | 356 | { jwin_slider_proc, 196, 56, 96, 8, vc(0), jwin_pal[jcBOX], 0, 0, 32, 0, NULL, (void *) set_vol, emus_dp }, | |
| 5668 | 356 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5669 | 356 | { jwin_slider_proc, 196, 72, 96, 8, vc(0), jwin_pal[jcBOX], 0, 0, 32, 0, NULL, (void *) set_vol, sfx_dp }, | |
| 5670 | //20 | ||
| 5671 | 356 | { jwin_slider_proc, 196, 88, 96, 8, vc(0), jwin_pal[jcBOX], 0, 0, 3, 0, NULL, (void *) set_pan, pan_dp }, | |
| 5672 | 356 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5673 | 356 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5674 | 356 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5675 | 356 | { jwin_text_proc, 17, 40, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "MIDI Volume", NULL, NULL }, | |
| 5676 | 356 | { jwin_text_proc, 17, 56, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Music Volume (Enhanced Music)", NULL, NULL }, | |
| 5677 | 356 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5678 | 356 | { jwin_text_proc, 17, 72, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "SFX Volume", NULL, NULL }, | |
| 5679 | 356 | { jwin_text_proc, 17, 88, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "SFX Pan", NULL, NULL }, | |
| 5680 | 356 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5681 | //30 | ||
| 5682 | 356 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5683 | 356 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5684 | 356 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5685 | }; | ||
| 5686 | |||
| 5687 | char zc_builddate[80]; | ||
| 5688 | char zc_aboutstr[80]; | ||
| 5689 | |||
| 5690 | static DIALOG about_dlg[] = | ||
| 5691 | { | ||
| 5692 | /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */ | ||
| 5693 | { jwin_win_proc, 68, 52, 184, 154, 0, 0, 0, D_EXIT, 0, 0, (void *) "About", NULL, NULL }, | ||
| 5694 | { jwin_button_proc, 140, 176, 41, 21, vc(14), 0, 0, D_EXIT, 0, 0, (void *) "OK", NULL, NULL }, | ||
| 5695 | { jwin_ctext_proc, 160, 84, 0, 8, vc(0), vc(11), 0, 0, 0, 0, zc_aboutstr, NULL, NULL }, | ||
| 5696 | { jwin_ctext_proc, 160, 92, 0, 8, vc(0) , vc(11), 0, 0, 0, 0, str_s, NULL, NULL }, | ||
| 5697 | { jwin_ctext_proc, 160, 100, 0, 8, vc(0) , vc(11), 0, 0, 0, 0, zc_builddate, NULL, NULL }, | ||
| 5698 | { jwin_text_proc, 88, 124, 140, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Coded by:", NULL, NULL }, | ||
| 5699 | { jwin_text_proc, 88, 132, 140, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) " Phantom Menace", NULL, NULL }, | ||
| 5700 | { jwin_text_proc, 88, 144, 140, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Produced by:", NULL, NULL }, | ||
| 5701 | { jwin_text_proc, 88, 152, 140, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) " Armageddon Games", NULL, NULL }, | ||
| 5702 | { jwin_frame_proc, 80, 117, 160, 50, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5703 | { d_timer_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 5704 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } | ||
| 5705 | }; | ||
| 5706 | |||
| 5707 | |||
| 5708 | static DIALOG quest_dlg[] = | ||
| 5709 | { | ||
| 5710 | /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */ | ||
| 5711 | { jwin_win_proc, 68, 25, 184, 190, 0, 0, 0, D_EXIT, 0, 0, (void *) "Quest Info", NULL, NULL }, | ||
| 5712 | { jwin_edit_proc, 84, 54, 152, 16, 0, 0, 0, D_READONLY, 100, 0, NULL, NULL, NULL }, | ||
| 5713 | { jwin_text_proc, 89, 84, 141, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Number:", NULL, NULL }, | ||
| 5714 | { jwin_text_proc, 152, 84, 24, 8, vc(7), vc(11), 0, 0, 0, 0, str_a, NULL, NULL }, | ||
| 5715 | { jwin_text_proc, 89, 94, 141, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Version:", NULL, NULL }, | ||
| 5716 | { jwin_text_proc, 160, 94, 64, 8, vc(7), vc(11), 0, 0, 0, 0, header_version_nul_term, NULL, NULL }, | ||
| 5717 | { jwin_text_proc, 89, 104, 141, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "ZQ Version:", NULL, NULL }, | ||
| 5718 | { jwin_text_proc, 130, 104, 64, 8, vc(7), vc(11), 0, 0, 0, 0, str_s, NULL, NULL }, | ||
| 5719 | { jwin_text_proc, 84, 126, 80, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Title:", NULL, NULL }, | ||
| 5720 | { jwin_textbox_proc, 84, 136, 152, 24, 0, 0, 0, 0, 0, 0, QHeader.title, NULL, NULL }, | ||
| 5721 | { jwin_text_proc, 84, 168, 80, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Author:", NULL, NULL }, | ||
| 5722 | { jwin_textbox_proc, 84, 178, 152, 24, 0, 0, 0, 0, 0, 0, QHeader.author, NULL, NULL }, | ||
| 5723 | { jwin_frame_proc, 84, 79, 152, 38, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5724 | { d_timer_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 5725 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } | ||
| 5726 | }; | ||
| 5727 | |||
| 5728 | static DIALOG triforce_dlg[] = | ||
| 5729 | { | ||
| 5730 | /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) */ | ||
| 5731 | { jwin_win_proc, 72, 64, 177, 105, vc(14), vc(1), 0, D_EXIT, 0, 0, (void *) "Triforce Pieces", NULL, NULL }, | ||
| 5732 | // 1 | ||
| 5733 | { jwin_check_proc, 129, 94, 24, 9, vc(0), vc(11), 0, 0, 1, 0, (void *) "1", NULL, NULL }, | ||
| 5734 | { jwin_check_proc, 129, 104, 24, 9, vc(0), vc(11), 0, 0, 1, 0, (void *) "2", NULL, NULL }, | ||
| 5735 | { jwin_check_proc, 129, 114, 24, 9, vc(0), vc(11), 0, 0, 1, 0, (void *) "3", NULL, NULL }, | ||
| 5736 | { jwin_check_proc, 129, 124, 24, 9, vc(0), vc(11), 0, 0, 1, 0, (void *) "4", NULL, NULL }, | ||
| 5737 | { jwin_check_proc, 172, 94, 24, 9, vc(0), vc(11), 0, 0, 1, 0, (void *) "5", NULL, NULL }, | ||
| 5738 | { jwin_check_proc, 172, 104, 24, 9, vc(0), vc(11), 0, 0, 1, 0, (void *) "6", NULL, NULL }, | ||
| 5739 | { jwin_check_proc, 172, 114, 24, 9, vc(0), vc(11), 0, 0, 1, 0, (void *) "7", NULL, NULL }, | ||
| 5740 | { jwin_check_proc, 172, 124, 24, 9, vc(0), vc(11), 0, 0, 1, 0, (void *) "8", NULL, NULL }, | ||
| 5741 | // 9 | ||
| 5742 | { jwin_button_proc, 90, 144, 61, 21, vc(0), vc(11), 'k', D_EXIT, 0, 0, (void *) "O&K", NULL, NULL }, | ||
| 5743 | { jwin_button_proc, 170, 144, 61, 21, vc(0), vc(11), 27, D_EXIT, 0, 0, (void *) "Cancel", NULL, NULL }, | ||
| 5744 | { d_timer_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 5745 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } | ||
| 5746 | }; | ||
| 5747 | |||
| 5748 | ✗ | int32_t onToggleRecordingNewSaves() | |
| 5749 | { | ||
| 5750 | ✗ | if (zc_get_config("zeldadx", "replay_new_saves", false)) | |
| 5751 | { | ||
| 5752 | ✗ | zc_set_config("zeldadx", "replay_new_saves", false); | |
| 5753 | ✗ | } | |
| 5754 | else | ||
| 5755 | { | ||
| 5756 | ✗ | zc_set_config("zeldadx", "replay_new_saves", true); | |
| 5757 | ✗ | jwin_alert("Recording", "Newly created saves will be recorded and written to a replay file.", | |
| 5758 | ✗ | NULL,NULL,"OK",NULL,13,27,get_zc_font(font_lfont)); | |
| 5759 | } | ||
| 5760 | ✗ | return D_O_K; | |
| 5761 | } | ||
| 5762 | |||
| 5763 | #ifdef HAS_CURL | ||
| 5764 | ✗ | int32_t onToggleAutoUploadReplays() | |
| 5765 | { | ||
| 5766 | ✗ | if (zc_get_config("zeldadx", "replay_upload", false)) | |
| 5767 | { | ||
| 5768 | ✗ | zc_set_config("zeldadx", "replay_upload", false); | |
| 5769 | ✗ | } | |
| 5770 | else | ||
| 5771 | { | ||
| 5772 | ✗ | zc_set_config("zeldadx", "replay_upload", true); | |
| 5773 | ✗ | jwin_alert("Replays", "Replays will be automatically uploaded. This helps development by", | |
| 5774 | " preventing bugs and simplifying bug reports.", | ||
| 5775 | "Upload will happen no more than once a week when closing ZC", | ||
| 5776 | ✗ | "OK",NULL,13,27,get_zc_font(font_lfont)); | |
| 5777 | |||
| 5778 | ✗ | if (!zc_get_config("zeldadx", "replay_new_saves", false)) | |
| 5779 | ✗ | onToggleRecordingNewSaves(); | |
| 5780 | } | ||
| 5781 | ✗ | return D_O_K; | |
| 5782 | } | ||
| 5783 | |||
| 5784 | ✗ | int32_t onUploadReplays() | |
| 5785 | { | ||
| 5786 | ✗ | if(jwin_alert3( | |
| 5787 | "Upload replays", | ||
| 5788 | "Upload your replays now to assist in development?", | ||
| 5789 | NULL, | ||
| 5790 | NULL, | ||
| 5791 | "&Yes", | ||
| 5792 | "&No", | ||
| 5793 | NULL, | ||
| 5794 | 'y', | ||
| 5795 | 'n', | ||
| 5796 | 0, | ||
| 5797 | ✗ | get_zc_font(font_lfont)) == 1) | |
| 5798 | { | ||
| 5799 | ✗ | int num_uploaded = replay_upload(); | |
| 5800 | ✗ | jwin_alert("Upload replays", fmt::format("Uploaded {} replays", num_uploaded).c_str(), | |
| 5801 | ✗ | NULL,NULL,"OK",NULL,13,27,get_zc_font(font_lfont)); | |
| 5802 | ✗ | } | |
| 5803 | ✗ | return D_O_K; | |
| 5804 | ✗ | } | |
| 5805 | |||
| 5806 | ✗ | int32_t onClearUploadCache() | |
| 5807 | { | ||
| 5808 | ✗ | if(jwin_alert3( | |
| 5809 | "Upload replays", | ||
| 5810 | "Clear the upload cache?", | ||
| 5811 | "This simply deletes replays/state.json. There's no harm in doing this, but", | ||
| 5812 | "likely is not necessary.", | ||
| 5813 | "&Yes", | ||
| 5814 | "&No", | ||
| 5815 | NULL, | ||
| 5816 | 'y', | ||
| 5817 | 'n', | ||
| 5818 | 0, | ||
| 5819 | ✗ | get_zc_font(font_lfont)) == 1) | |
| 5820 | { | ||
| 5821 | ✗ | replay_upload_clear_cache(); | |
| 5822 | ✗ | } | |
| 5823 | ✗ | return D_O_K; | |
| 5824 | } | ||
| 5825 | #endif | ||
| 5826 | |||
| 5827 | ✗ | int32_t onToggleSnapshotAllFrames() | |
| 5828 | { | ||
| 5829 | ✗ | replay_set_snapshot_all_frames(!replay_is_snapshot_all_frames()); | |
| 5830 | ✗ | return D_O_K; | |
| 5831 | } | ||
| 5832 | |||
| 5833 | ✗ | int32_t onStopReplayOrRecord() | |
| 5834 | { | ||
| 5835 | ✗ | if (replay_is_replaying()) | |
| 5836 | { | ||
| 5837 | ✗ | replay_quit(); | |
| 5838 | ✗ | } | |
| 5839 | ✗ | else if (replay_get_mode() == ReplayMode::Record) | |
| 5840 | { | ||
| 5841 | ✗ | if (!replay_get_meta_bool("test_mode")) | |
| 5842 | { | ||
| 5843 | ✗ | jwin_alert("Recording", "You cannot stop recording a save file.", | |
| 5844 | ✗ | NULL,NULL,"OK",NULL,13,27,get_zc_font(font_lfont)); | |
| 5845 | ✗ | return D_CLOSE; | |
| 5846 | } | ||
| 5847 | |||
| 5848 | ✗ | if (jwin_alert("Stop Recording", | |
| 5849 | "Save replay to disk and stop recording?", | ||
| 5850 | "This will stop the recording.", | ||
| 5851 | NULL, | ||
| 5852 | ✗ | "Yes","No",13,27,get_zc_font(font_lfont)) != 1) | |
| 5853 | ✗ | return D_CLOSE; | |
| 5854 | |||
| 5855 | ✗ | replay_save(); | |
| 5856 | ✗ | replay_stop(); | |
| 5857 | ✗ | } | |
| 5858 | ✗ | return D_O_K; | |
| 5859 | ✗ | } | |
| 5860 | |||
| 5861 | ✗ | static int32_t handle_on_load_replay(ReplayMode mode) | |
| 5862 | { | ||
| 5863 | ✗ | bool ctrl = CHECK_CTRL_CMD; | |
| 5864 | ✗ | if (Playing) | |
| 5865 | { | ||
| 5866 | ✗ | if (jwin_alert("Replay - Warning!", | |
| 5867 | "Loading a replay will exit the current game.", | ||
| 5868 | "All unsaved progress will be lost.", | ||
| 5869 | "Do you wish to continue?", | ||
| 5870 | ✗ | "Yes","No",13,27,get_zc_font(font_lfont)) != 1) | |
| 5871 | ✗ | return D_CLOSE; | |
| 5872 | ✗ | } | |
| 5873 | |||
| 5874 | ✗ | std::string mode_string = replay_mode_to_string(mode); | |
| 5875 | ✗ | mode_string[0] = std::toupper(mode_string[0]); | |
| 5876 | |||
| 5877 | ✗ | std::string line_1 = "Select a replay file to play back."; | |
| 5878 | ✗ | std::string line_2 = "You won't be able to save, and it won't effect existing saves."; | |
| 5879 | ✗ | std::string line_3 = "You can stop the replay and take over manually any time."; | |
| 5880 | ✗ | if (mode == ReplayMode::Update) | |
| 5881 | { | ||
| 5882 | ✗ | line_1 = "Select a replay file to update."; | |
| 5883 | ✗ | line_2 = "WARNING: be sure to back up the zplay file"; | |
| 5884 | ✗ | line_3 = "and verify that the updated replay works as expected!"; | |
| 5885 | ✗ | } | |
| 5886 | |||
| 5887 | ✗ | if (jwin_alert(mode_string.c_str(), | |
| 5888 | ✗ | line_1.c_str(), | |
| 5889 | ✗ | line_2.c_str(), | |
| 5890 | ✗ | line_3.c_str(), | |
| 5891 | ✗ | "OK","Nevermind",13,27,get_zc_font(font_lfont)) == 1) | |
| 5892 | { | ||
| 5893 | ✗ | std::string replay_path = "replays/"; | |
| 5894 | ✗ | if(ctrl && devpwd()) | |
| 5895 | ✗ | replay_path = "../../tests/replays/"; | |
| 5896 | ✗ | std::string prompt = fmt::format("Load Replay ({})", REPLAY_EXTENSION); | |
| 5897 | ✗ | if (auto result = prompt_for_existing_file(prompt, REPLAY_EXTENSION, nullptr, replay_path)) | |
| 5898 | ✗ | replay_path = *result; | |
| 5899 | else | ||
| 5900 | ✗ | return D_CLOSE; | |
| 5901 | |||
| 5902 | ✗ | replay_quit(); | |
| 5903 | ✗ | load_replay_file_deferred(mode, replay_path); | |
| 5904 | ✗ | Quit = qRESET; | |
| 5905 | ✗ | return D_CLOSE; | |
| 5906 | ✗ | } | |
| 5907 | ✗ | return D_O_K; | |
| 5908 | ✗ | } | |
| 5909 | |||
| 5910 | ✗ | int32_t onLoadReplay() | |
| 5911 | { | ||
| 5912 | ✗ | return handle_on_load_replay(ReplayMode::Replay); | |
| 5913 | } | ||
| 5914 | |||
| 5915 | ✗ | int32_t onLoadReplayAssert() | |
| 5916 | { | ||
| 5917 | ✗ | return handle_on_load_replay(ReplayMode::Assert); | |
| 5918 | } | ||
| 5919 | |||
| 5920 | ✗ | int32_t onLoadReplayUpdate() | |
| 5921 | { | ||
| 5922 | ✗ | return handle_on_load_replay(ReplayMode::Update); | |
| 5923 | } | ||
| 5924 | |||
| 5925 | ✗ | int32_t onSaveReplay() | |
| 5926 | { | ||
| 5927 | ✗ | if (replay_get_mode() == ReplayMode::Record) | |
| 5928 | { | ||
| 5929 | ✗ | if (!replay_get_meta_bool("test_mode")) | |
| 5930 | { | ||
| 5931 | ✗ | if (jwin_alert("Save Replay", | |
| 5932 | "This will save a copy of the replay up to this point.", | ||
| 5933 | "The official replay file will be untouched.", | ||
| 5934 | "Do you wish to continue?", | ||
| 5935 | ✗ | "Yes","No",13,27,get_zc_font(font_lfont)) != 1) | |
| 5936 | { | ||
| 5937 | ✗ | return D_CLOSE; | |
| 5938 | } | ||
| 5939 | |||
| 5940 | ✗ | std::string replay_path = replay_get_replay_path().string(); | |
| 5941 | ✗ | std::string prompt = fmt::format("Save Replay ({})", REPLAY_EXTENSION); | |
| 5942 | ✗ | if (auto result = prompt_for_new_file(prompt, REPLAY_EXTENSION, nullptr, replay_path)) | |
| 5943 | ✗ | replay_path = *result; | |
| 5944 | else | ||
| 5945 | ✗ | return D_CLOSE; | |
| 5946 | |||
| 5947 | ✗ | if (fileexists(replay_path.c_str())) | |
| 5948 | { | ||
| 5949 | ✗ | jwin_alert("Save Replay", "You cannot overwrite an existing file.", | |
| 5950 | ✗ | NULL,NULL,"OK",NULL,13,27,get_zc_font(font_lfont)); | |
| 5951 | ✗ | return D_CLOSE; | |
| 5952 | } | ||
| 5953 | |||
| 5954 | ✗ | replay_save(replay_path); | |
| 5955 | ✗ | } | |
| 5956 | else | ||
| 5957 | { | ||
| 5958 | ✗ | replay_save(); | |
| 5959 | } | ||
| 5960 | ✗ | } | |
| 5961 | ✗ | return D_O_K; | |
| 5962 | ✗ | } | |
| 5963 | |||
| 5964 | enum | ||
| 5965 | { | ||
| 5966 | MENUID_REPLAY_RECORDNEW, | ||
| 5967 | MENUID_REPLAY_STOP, | ||
| 5968 | MENUID_REPLAY_SAVE, | ||
| 5969 | MENUID_REPLAY_SNAP_ALL, | ||
| 5970 | MENUID_REPLAY_AUTOUPLOAD, | ||
| 5971 | MENUID_REPLAY_UPLOAD, | ||
| 5972 | MENUID_REPLAY_CLEARUPLOADCACHE, | ||
| 5973 | }; | ||
| 5974 |
1/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
356 | static NewMenu replay_menu |
| 5975 | 4628 | { | |
| 5976 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Record new saves", onToggleRecordingNewSaves, MENUID_REPLAY_RECORDNEW }, |
| 5977 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | {}, |
| 5978 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Stop replay", onStopReplayOrRecord, MENUID_REPLAY_STOP }, |
| 5979 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Load replay", onLoadReplay }, |
| 5980 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Load replay (assert)", onLoadReplayAssert }, |
| 5981 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Load replay (update)", onLoadReplayUpdate }, |
| 5982 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Save replay", onSaveReplay, MENUID_REPLAY_SAVE }, |
| 5983 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Snapshot all frames", onToggleSnapshotAllFrames, MENUID_REPLAY_SNAP_ALL }, |
| 5984 | #ifdef HAS_CURL | ||
| 5985 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | {}, |
| 5986 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Auto upload replays", onToggleAutoUploadReplays, MENUID_REPLAY_AUTOUPLOAD }, |
| 5987 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Upload replays", onUploadReplays, MENUID_REPLAY_UPLOAD }, |
| 5988 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Clear upload cache", onClearUploadCache, MENUID_REPLAY_CLEARUPLOADCACHE }, |
| 5989 | #endif | ||
| 5990 | }; | ||
| 5991 | |||
| 5992 | static DIALOG credits_dlg[] = | ||
| 5993 | { | ||
| 5994 | /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */ | ||
| 5995 | { jwin_win_proc, 40, 38, 241, 173, vc(14), vc(1), 0, D_EXIT, 0, 0, (void *) "ZQuest Classic Credits", NULL, NULL }, | ||
| 5996 | { jwin_frame_proc, 47, 65, 227, 115, vc(15), vc(1), 0, 0, FR_DEEP, 0, NULL, NULL, NULL }, | ||
| 5997 | { d_bitmap_proc, 49, 67, 222, 110, vc(15), vc(1), 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 5998 | { jwin_button_proc, 140, 184, 41, 21, vc(14), vc(1), 0, D_EXIT, 0, 0, (void *) "OK", NULL, NULL }, | ||
| 5999 | { d_timer_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 6000 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } | ||
| 6001 | }; | ||
| 6002 | |||
| 6003 | 356 | static ListData dmap_list(dmaplist, &font); | |
| 6004 | |||
| 6005 | static DIALOG goto_dlg[] = | ||
| 6006 | { | ||
| 6007 | /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */ | ||
| 6008 | { jwin_win_proc, 48, 25, 205, 100, 0, 0, 0, D_EXIT, 0, 0, (void *) "Goto Location", NULL, NULL }, | ||
| 6009 | { jwin_button_proc, 90, 176-78, 61, 21, vc(14), 0, 13, D_EXIT, 0, 0, (void *) "OK", NULL, NULL }, | ||
| 6010 | { jwin_button_proc, 170, 176-78, 61, 21, vc(14), 0, 27, D_EXIT, 0, 0, (void *) "Cancel", NULL, NULL }, | ||
| 6011 | { jwin_text_proc, 55, 129-75, 80, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "DMap:", NULL, NULL }, | ||
| 6012 | { jwin_droplist_proc, 88, 126-75, 160, 16, 0, 0, 0, 0, 0, 0, (void *) &dmap_list, NULL, NULL }, | ||
| 6013 | { jwin_text_proc, 55, 149-75, 80, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Screen:", NULL, NULL }, | ||
| 6014 | { jwin_edit_proc, 132, 146-75, 91, 16, 0, 0, 0, 0, 2, 0, NULL, NULL, NULL }, | ||
| 6015 | { d_timer_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 6016 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } | ||
| 6017 | }; | ||
| 6018 | |||
| 6019 | ✗ | int32_t onGoTo() | |
| 6020 | { | ||
| 6021 | ✗ | bool music = false; | |
| 6022 | ✗ | music = music; | |
| 6023 | ✗ | sprintf(cheat_goto_screen_str,"%X",cheat_goto_screen); | |
| 6024 | |||
| 6025 | ✗ | goto_dlg[0].dp2=get_zc_font(font_lfont); | |
| 6026 | ✗ | goto_dlg[4].d2=cheat_goto_dmap; | |
| 6027 | ✗ | goto_dlg[6].dp=cheat_goto_screen_str; | |
| 6028 | |||
| 6029 | ✗ | clear_keybuf(); | |
| 6030 | |||
| 6031 | ✗ | large_dialog(goto_dlg); | |
| 6032 | |||
| 6033 | ✗ | if(do_zqdialog(goto_dlg,4)==1) | |
| 6034 | { | ||
| 6035 | // dmap, screen | ||
| 6036 | ✗ | cheats_enqueue(Cheat::GoTo, goto_dlg[4].d2, zc_min(zc_xtoi(cheat_goto_screen_str),0x7F)); | |
| 6037 | ✗ | }; | |
| 6038 | |||
| 6039 | ✗ | return D_O_K; | |
| 6040 | ✗ | } | |
| 6041 | |||
| 6042 | ✗ | int32_t onGoToComplete() | |
| 6043 | { | ||
| 6044 | ✗ | if(!Playing) | |
| 6045 | { | ||
| 6046 | ✗ | return D_O_K; | |
| 6047 | } | ||
| 6048 | |||
| 6049 | ✗ | enter_sys_pal(); | |
| 6050 | ✗ | music_pause(); | |
| 6051 | ✗ | pause_all_sfx(); | |
| 6052 | ✗ | onGoTo(); | |
| 6053 | ✗ | eat_buttons(); | |
| 6054 | |||
| 6055 | ✗ | zc_readrawkey(KEY_ESC); | |
| 6056 | |||
| 6057 | ✗ | exit_sys_pal(); | |
| 6058 | ✗ | music_resume(); | |
| 6059 | ✗ | resume_all_sfx(); | |
| 6060 | ✗ | return D_O_K; | |
| 6061 | ✗ | } | |
| 6062 | |||
| 6063 | ✗ | int32_t onCredits() | |
| 6064 | { | ||
| 6065 | ✗ | return D_O_K; | |
| 6066 | } | ||
| 6067 | |||
| 6068 | ✗ | const char *midilist(int32_t index, int32_t *list_size) | |
| 6069 | { | ||
| 6070 | ✗ | if(index<0) | |
| 6071 | { | ||
| 6072 | ✗ | *list_size=0; | |
| 6073 | |||
| 6074 | ✗ | for(int32_t i=0; i<MAXMIDIS; i++) | |
| 6075 | ✗ | if(tunes[i].data) | |
| 6076 | ✗ | ++(*list_size); | |
| 6077 | |||
| 6078 | ✗ | return NULL; | |
| 6079 | } | ||
| 6080 | |||
| 6081 | ✗ | int32_t i=0,m=0; | |
| 6082 | |||
| 6083 | ✗ | while(m<=index && i<=MAXMIDIS) | |
| 6084 | { | ||
| 6085 | ✗ | if(tunes[i].data) | |
| 6086 | ✗ | ++m; | |
| 6087 | |||
| 6088 | ✗ | ++i; | |
| 6089 | } | ||
| 6090 | |||
| 6091 | ✗ | --i; | |
| 6092 | |||
| 6093 | ✗ | if(i==MAXMIDIS && m<index) | |
| 6094 | ✗ | return "(null)"; | |
| 6095 | |||
| 6096 | ✗ | return tunes[i].title; | |
| 6097 | ✗ | } | |
| 6098 | |||
| 6099 | /* ------- MIDI info stuff -------- */ | ||
| 6100 | |||
| 6101 | char *text; | ||
| 6102 | midi_info *zmi; | ||
| 6103 | bool dialog_running; | ||
| 6104 | bool listening; | ||
| 6105 | |||
| 6106 | void get_info(int32_t index); | ||
| 6107 | |||
| 6108 | ✗ | int32_t d_midilist_proc(int32_t msg,DIALOG *d,int32_t c) | |
| 6109 | { | ||
| 6110 | ✗ | int32_t d2 = d->d2; | |
| 6111 | ✗ | int32_t ret = jwin_droplist_proc(msg,d,c); | |
| 6112 | |||
| 6113 | ✗ | if(d2!=d->d2) | |
| 6114 | { | ||
| 6115 | ✗ | get_info(d->d2); | |
| 6116 | ✗ | } | |
| 6117 | |||
| 6118 | ✗ | return ret; | |
| 6119 | } | ||
| 6120 | |||
| 6121 | ✗ | int32_t d_listen_proc(int32_t msg,DIALOG *d,int32_t c) | |
| 6122 | { | ||
| 6123 | /* 'd->d1' is offset from 'd' in DIALOG array to midilist proc */ | ||
| 6124 | |||
| 6125 | ✗ | int32_t ret = jwin_button_proc(msg,d,c); | |
| 6126 | |||
| 6127 | ✗ | if(ret == D_CLOSE) | |
| 6128 | { | ||
| 6129 | // get current midi index | ||
| 6130 | ✗ | int32_t index = (d+(d->d1))->d2; | |
| 6131 | ✗ | int32_t i=0, m=0; | |
| 6132 | |||
| 6133 | ✗ | while(m<=index && i<=MAXMIDIS) | |
| 6134 | { | ||
| 6135 | ✗ | if(tunes[i].data) | |
| 6136 | ✗ | ++m; | |
| 6137 | |||
| 6138 | ✗ | ++i; | |
| 6139 | } | ||
| 6140 | |||
| 6141 | ✗ | --i; | |
| 6142 | ✗ | jukebox(i); | |
| 6143 | ✗ | listening = true; | |
| 6144 | ✗ | ret = D_O_K; | |
| 6145 | ✗ | } | |
| 6146 | |||
| 6147 | ✗ | return ret; | |
| 6148 | } | ||
| 6149 | |||
| 6150 | ✗ | int32_t d_savemidi_proc(int32_t msg,DIALOG *d,int32_t c) | |
| 6151 | { | ||
| 6152 | /* 'd->d1' is offset from 'd' in DIALOG array to midilist proc */ | ||
| 6153 | |||
| 6154 | ✗ | int32_t ret = jwin_button_proc(msg,d,c); | |
| 6155 | |||
| 6156 | ✗ | if(ret == D_CLOSE) | |
| 6157 | { | ||
| 6158 | // get current midi index | ||
| 6159 | ✗ | int32_t index = (d+(d->d1))->d2; | |
| 6160 | ✗ | int32_t i=0, m=0; | |
| 6161 | |||
| 6162 | ✗ | while(m<=index && i<=MAXMIDIS) | |
| 6163 | { | ||
| 6164 | ✗ | if(tunes[i].data) | |
| 6165 | ✗ | ++m; | |
| 6166 | |||
| 6167 | ✗ | ++i; | |
| 6168 | } | ||
| 6169 | |||
| 6170 | ✗ | --i; | |
| 6171 | |||
| 6172 | ✗ | char title[40] = "Save MIDI: "; | |
| 6173 | static EXT_LIST list[] = | ||
| 6174 | { | ||
| 6175 | { (char *)"MIDI files (*.mid)", (char *)"mid" }, | ||
| 6176 | { NULL, NULL } | ||
| 6177 | }; | ||
| 6178 | |||
| 6179 | ✗ | strcpy(title+11, tunes[i].title); | |
| 6180 | ✗ | title[39] = '\0'; | |
| 6181 | |||
| 6182 | ✗ | std::string fname; | |
| 6183 | ✗ | if (auto result = prompt_for_new_file(title, "", list, "tune.mid")) | |
| 6184 | ✗ | fname = *result; | |
| 6185 | else | ||
| 6186 | ✗ | goto done; | |
| 6187 | |||
| 6188 | ✗ | if(exists(fname.c_str())) | |
| 6189 | { | ||
| 6190 | ✗ | if(jwin_alert(title, fname.c_str(), "already exists.", "Overwrite it?", "&Yes","&No",'y','n',get_zc_font(font_lfont))==2) | |
| 6191 | ✗ | goto done; | |
| 6192 | ✗ | } | |
| 6193 | |||
| 6194 | // save midi i | ||
| 6195 | |||
| 6196 | ✗ | if (save_midi(fname.c_str(), (MIDI*)tunes[i].data) != 0) | |
| 6197 | ✗ | jwin_alert(title, "Error saving MIDI to", fname.c_str(), NULL, "Darn", NULL,13,27,get_zc_font(font_lfont)); | |
| 6198 | |||
| 6199 | done: | ||
| 6200 | ✗ | chop_path(fname.data()); | |
| 6201 | ✗ | ret = D_REDRAW; | |
| 6202 | ✗ | } | |
| 6203 | |||
| 6204 | ✗ | return ret; | |
| 6205 | ✗ | } | |
| 6206 | |||
| 6207 | 356 | static ListData midi_list(midilist, &font); | |
| 6208 | |||
| 6209 | static DIALOG midi_dlg[] = | ||
| 6210 | { | ||
| 6211 | /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */ | ||
| 6212 | { jwin_win_proc, 8, 28, 304, 184, 0, 0, 0, D_EXIT, 0, 0, (void *) "MIDI Info", NULL, NULL }, | ||
| 6213 | { jwin_text_proc, 32, 60, 40, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Tune:", NULL, NULL }, | ||
| 6214 | { d_midilist_proc, 80, 56, 192, 16, 0, 0, 0, 0, 0, 0, (void *) &midi_list, NULL, NULL }, | ||
| 6215 | { jwin_textbox_proc, 15, 80, 290, 96, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 6216 | { d_listen_proc, 24, 183, 72, 21, 0, 0, 'l', D_EXIT, -2, 0, (void *) "&Listen", NULL, NULL }, | ||
| 6217 | { d_savemidi_proc, 108, 183, 72, 21, 0, 0, 's', D_EXIT, -3, 0, (void *) "&Save", NULL, NULL }, | ||
| 6218 | { jwin_button_proc, 236, 183, 61, 21, 0, 0, 'k', D_EXIT, 0, 0, (void *) "O&K", NULL, NULL }, | ||
| 6219 | { d_timer_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 6220 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } | ||
| 6221 | }; | ||
| 6222 | |||
| 6223 | ✗ | void get_info(int32_t index) | |
| 6224 | { | ||
| 6225 | ✗ | int32_t i=0, m=0; | |
| 6226 | |||
| 6227 | ✗ | while(m<=index && i<=MAXMIDIS) | |
| 6228 | { | ||
| 6229 | ✗ | if(tunes[i].data) | |
| 6230 | ✗ | ++m; | |
| 6231 | |||
| 6232 | ✗ | ++i; | |
| 6233 | } | ||
| 6234 | |||
| 6235 | ✗ | --i; | |
| 6236 | |||
| 6237 | ✗ | if(i==MAXMIDIS && m<index) | |
| 6238 | ✗ | strcpy(text,"(null)"); | |
| 6239 | else | ||
| 6240 | { | ||
| 6241 | ✗ | get_midi_info((MIDI*)tunes[i].data,zmi); | |
| 6242 | ✗ | get_midi_text((MIDI*)tunes[i].data,zmi,text); | |
| 6243 | } | ||
| 6244 | |||
| 6245 | ✗ | midi_dlg[0].dp2=get_zc_font(font_lfont); | |
| 6246 | ✗ | midi_dlg[3].dp = text; | |
| 6247 | ✗ | midi_dlg[3].d1 = midi_dlg[3].d2 = 0; | |
| 6248 | ✗ | midi_dlg[5].flags = (tunes[i].flags&tfDISABLESAVE) ? D_DISABLED : D_EXIT; | |
| 6249 | |||
| 6250 | ✗ | if(dialog_running) | |
| 6251 | { | ||
| 6252 | ✗ | jwin_textbox_proc(MSG_DRAW,midi_dlg+3,0); | |
| 6253 | ✗ | d_savemidi_proc(MSG_DRAW,midi_dlg+5,0); | |
| 6254 | ✗ | } | |
| 6255 | ✗ | } | |
| 6256 | |||
| 6257 | ✗ | int32_t onMIDICredits() | |
| 6258 | { | ||
| 6259 | ✗ | text = (char*)malloc(4096); | |
| 6260 | ✗ | zmi = (midi_info*)malloc(sizeof(midi_info)); | |
| 6261 | |||
| 6262 | ✗ | if(!text || !zmi) | |
| 6263 | { | ||
| 6264 | ✗ | jwin_alert(NULL,"Not enough memory",NULL,NULL,"OK",NULL,13,27,get_zc_font(font_lfont)); | |
| 6265 | ✗ | return D_O_K; | |
| 6266 | } | ||
| 6267 | |||
| 6268 | ✗ | bool do_pause_midi = midi_pos >= 0 && currmidi; | |
| 6269 | ✗ | auto restore_midi = currmidi; | |
| 6270 | ✗ | if(do_pause_midi) | |
| 6271 | { | ||
| 6272 | ✗ | paused_midi_pos = midi_pos; | |
| 6273 | ✗ | stop_midi(); | |
| 6274 | ✗ | midi_suspended = midissuspHALTED; | |
| 6275 | ✗ | } | |
| 6276 | |||
| 6277 | ✗ | midi_dlg[0].dp2=get_zc_font(font_lfont); | |
| 6278 | ✗ | midi_dlg[2].d1 = 0; | |
| 6279 | ✗ | midi_dlg[2].d2 = 0; | |
| 6280 | ✗ | midi_dlg[4].flags = D_EXIT; | |
| 6281 | ✗ | midi_dlg[5].flags = (tunes[midi_dlg[2].d1].flags&tfDISABLESAVE) ? D_DISABLED : D_EXIT; | |
| 6282 | |||
| 6283 | ✗ | listening = false; | |
| 6284 | ✗ | dialog_running=false; | |
| 6285 | ✗ | get_info(0); | |
| 6286 | |||
| 6287 | ✗ | dialog_running=true; | |
| 6288 | |||
| 6289 | ✗ | large_dialog(midi_dlg); | |
| 6290 | |||
| 6291 | ✗ | do_zqdialog(midi_dlg,0); | |
| 6292 | ✗ | dialog_running=false; | |
| 6293 | |||
| 6294 | ✗ | if(listening) | |
| 6295 | ✗ | music_stop(); | |
| 6296 | |||
| 6297 | ✗ | if(do_pause_midi) | |
| 6298 | { | ||
| 6299 | // TODO: this probably doesn't resume midis nicely when scrolling (or in some other inner-gameloop). | ||
| 6300 | ✗ | midi_suspended = midissuspRESUME; | |
| 6301 | ✗ | currmidi = restore_midi; | |
| 6302 | ✗ | midi_pos = paused_midi_pos; | |
| 6303 | ✗ | } | |
| 6304 | |||
| 6305 | ✗ | if(text) free(text); | |
| 6306 | ✗ | if(zmi) free(zmi); | |
| 6307 | ✗ | return D_O_K; | |
| 6308 | ✗ | } | |
| 6309 | |||
| 6310 | ✗ | int32_t onAbout() | |
| 6311 | { | ||
| 6312 | ✗ | char buf1[80]={0}; | |
| 6313 | ✗ | std::ostringstream oss; | |
| 6314 | ✗ | sprintf(buf1,ZC_PLAYER_NAME); | |
| 6315 | ✗ | oss << buf1 << '\n'; | |
| 6316 | ✗ | sprintf(buf1,"Version: %s", getVersionString()); | |
| 6317 | ✗ | oss << buf1 << '\n'; | |
| 6318 | ✗ | sprintf(buf1,"Build Date: %s %s, %d at @ %s %s", dayextension(BUILDTM_DAY).c_str(), (char*)months[BUILDTM_MONTH], BUILDTM_YEAR, __TIME__, __TIMEZONE__); | |
| 6319 | ✗ | oss << buf1 << '\n'; | |
| 6320 | ✗ | sprintf(buf1, "Built By: %s", DEV_SIGNOFF); | |
| 6321 | ✗ | oss << buf1 << '\n'; | |
| 6322 | |||
| 6323 | ✗ | InfoDialog("About ZC", oss.str()).show(); | |
| 6324 | return D_O_K; | ||
| 6325 | ✗ | } | |
| 6326 | |||
| 6327 | ✗ | int32_t onQuest() | |
| 6328 | { | ||
| 6329 | char fname[100]; | ||
| 6330 | ✗ | strcpy(fname, get_filename(qstpath)); | |
| 6331 | ✗ | quest_dlg[0].dp2=get_zc_font(font_lfont); | |
| 6332 | ✗ | quest_dlg[1].dp = fname; | |
| 6333 | |||
| 6334 | ✗ | if(QHeader.quest_number==0) | |
| 6335 | ✗ | sprintf(str_a,"Custom"); | |
| 6336 | else | ||
| 6337 | ✗ | sprintf(str_a,"%d",QHeader.quest_number); | |
| 6338 | |||
| 6339 | ✗ | sprintf(str_s,"%s",QHeader.getVerStr()); | |
| 6340 | |||
| 6341 | ✗ | quest_dlg[11].d1 = quest_dlg[9].d1 = 0; | |
| 6342 | ✗ | quest_dlg[11].d2 = quest_dlg[9].d2 = 0; | |
| 6343 | |||
| 6344 | ✗ | large_dialog(quest_dlg); | |
| 6345 | |||
| 6346 | ✗ | do_zqdialog(quest_dlg, 0); | |
| 6347 | ✗ | return D_O_K; | |
| 6348 | } | ||
| 6349 | |||
| 6350 | void call_vidmode_dlg(); | ||
| 6351 | ✗ | int32_t onVidMode() | |
| 6352 | { | ||
| 6353 | ✗ | call_vidmode_dlg(); | |
| 6354 | ✗ | return D_O_K; | |
| 6355 | } | ||
| 6356 | |||
| 6357 | #define addToHash(c,b,h) if(h->find(c ## key) == h->end()) \ | ||
| 6358 | {(*h)[c ## key]=true;} else { if ( c ## key != 0 ) b = false;} | ||
| 6359 | //Added an extra statement, so that if the key is cleared to 0, the cleared | ||
| 6360 | //keybinding status need not be unique. -Z ( 1st April, 2019 ) | ||
| 6361 | |||
| 6362 | ✗ | void load_ukeys(int32_t* arr) | |
| 6363 | { | ||
| 6364 | ✗ | arr[ukey_a] = Akey; | |
| 6365 | ✗ | arr[ukey_b] = Bkey; | |
| 6366 | ✗ | arr[ukey_s] = Skey; | |
| 6367 | ✗ | arr[ukey_l] = Lkey; | |
| 6368 | ✗ | arr[ukey_r] = Rkey; | |
| 6369 | ✗ | arr[ukey_p] = Pkey; | |
| 6370 | ✗ | arr[ukey_ex1] = Exkey1; | |
| 6371 | ✗ | arr[ukey_ex2] = Exkey2; | |
| 6372 | ✗ | arr[ukey_ex3] = Exkey3; | |
| 6373 | ✗ | arr[ukey_ex4] = Exkey4; | |
| 6374 | ✗ | arr[ukey_du] = DUkey; | |
| 6375 | ✗ | arr[ukey_dd] = DDkey; | |
| 6376 | ✗ | arr[ukey_dl] = DLkey; | |
| 6377 | ✗ | arr[ukey_dr] = DRkey; | |
| 6378 | ✗ | arr[ukey_mod1a] = cheat_modifier_keys[0]; | |
| 6379 | ✗ | arr[ukey_mod1b] = cheat_modifier_keys[1]; | |
| 6380 | ✗ | arr[ukey_mod2a] = cheat_modifier_keys[2]; | |
| 6381 | ✗ | arr[ukey_mod2b] = cheat_modifier_keys[3]; | |
| 6382 | ✗ | }; | |
| 6383 | |||
| 6384 | static const char* ukey_names[] = { | ||
| 6385 | "A", "B", "Start", "L", "R", "Map", | ||
| 6386 | "Ex1", "Ex2", "Ex3", "Ex4", "Up", "Down", | ||
| 6387 | "Left", "Right", "Cheat Mod L1", "Cheat Mod L2", | ||
| 6388 | "Cheat Mod R1", "Cheat Mod R2", | ||
| 6389 | }; | ||
| 6390 | ✗ | std::string get_ukey_name(int32_t k) | |
| 6391 | { | ||
| 6392 | ✗ | if (k < num_ukey) return ukey_names[k]; | |
| 6393 | ✗ | return ""; | |
| 6394 | ✗ | } | |
| 6395 | |||
| 6396 | ✗ | int32_t onKeyboard() | |
| 6397 | { | ||
| 6398 | ✗ | int32_t a = Akey; | |
| 6399 | ✗ | int32_t b = Bkey; | |
| 6400 | ✗ | int32_t s = Skey; | |
| 6401 | ✗ | int32_t l = Lkey; | |
| 6402 | ✗ | int32_t r = Rkey; | |
| 6403 | ✗ | int32_t p = Pkey; | |
| 6404 | ✗ | int32_t ex1 = Exkey1; | |
| 6405 | ✗ | int32_t ex2 = Exkey2; | |
| 6406 | ✗ | int32_t ex3 = Exkey3; | |
| 6407 | ✗ | int32_t ex4 = Exkey4; | |
| 6408 | ✗ | int32_t du = DUkey; | |
| 6409 | ✗ | int32_t dd = DDkey; | |
| 6410 | ✗ | int32_t dl = DLkey; | |
| 6411 | ✗ | int32_t dr = DRkey; | |
| 6412 | ✗ | int32_t mod1a = cheat_modifier_keys[0]; | |
| 6413 | ✗ | int32_t mod1b = cheat_modifier_keys[1]; | |
| 6414 | ✗ | int32_t mod2a = cheat_modifier_keys[2]; | |
| 6415 | ✗ | int32_t mod2b = cheat_modifier_keys[3]; | |
| 6416 | ✗ | bool done=false; | |
| 6417 | int32_t ret; | ||
| 6418 | |||
| 6419 | ✗ | keyboard_control_dlg[0].dp2=get_zc_font(font_lfont); | |
| 6420 | |||
| 6421 | ✗ | large_dialog(keyboard_control_dlg); | |
| 6422 | |||
| 6423 | ✗ | while(!done) | |
| 6424 | { | ||
| 6425 | ✗ | ret = do_zqdialog(keyboard_control_dlg,3); | |
| 6426 | |||
| 6427 | ✗ | if(ret==3) // OK | |
| 6428 | { | ||
| 6429 | int32_t ukeys[num_ukey]; | ||
| 6430 | ✗ | load_ukeys(ukeys); | |
| 6431 | ✗ | std::vector<std::string> uniqueError; | |
| 6432 | ✗ | for(int32_t q = 0; q < num_ukey; ++q) | |
| 6433 | { | ||
| 6434 | ✗ | for(int32_t p = q+1; p < num_ukey; ++p) | |
| 6435 | { | ||
| 6436 | ✗ | if(ukeys[q] == ukeys[p] && ukeys[q] != 0) | |
| 6437 | { | ||
| 6438 | char buf[64]; | ||
| 6439 | ✗ | sprintf(buf, "'%s' conflicts with '%s'", get_ukey_name(q).c_str(), get_ukey_name(p).c_str()); | |
| 6440 | ✗ | std::string str(buf); | |
| 6441 | ✗ | uniqueError.push_back(str); | |
| 6442 | ✗ | } | |
| 6443 | ✗ | } | |
| 6444 | ✗ | } | |
| 6445 | ✗ | if(uniqueError.size() == 0) | |
| 6446 | { | ||
| 6447 | ✗ | done = true; | |
| 6448 | ✗ | save_control_configs(true); | |
| 6449 | ✗ | } | |
| 6450 | else | ||
| 6451 | { | ||
| 6452 | ✗ | box_start(1, "Duplicate Keys", get_zc_font(font_lfont), get_zc_font(font_sfont), false, keyboard_control_dlg[0].w,keyboard_control_dlg[0].h, 2); | |
| 6453 | ✗ | box_out("Cannot have duplicate keybinds!"); box_eol(); | |
| 6454 | ✗ | for(std::vector<std::string>::iterator it = uniqueError.begin(); | |
| 6455 | ✗ | it != uniqueError.end(); ++it) | |
| 6456 | { | ||
| 6457 | ✗ | box_out((*it).c_str()); box_eol(); | |
| 6458 | ✗ | } | |
| 6459 | ✗ | box_end(true); | |
| 6460 | } | ||
| 6461 | ✗ | } | |
| 6462 | else // Cancel | ||
| 6463 | { | ||
| 6464 | ✗ | Akey = a; | |
| 6465 | ✗ | Bkey = b; | |
| 6466 | ✗ | Skey = s; | |
| 6467 | ✗ | Lkey = l; | |
| 6468 | ✗ | Rkey = r; | |
| 6469 | ✗ | Pkey = p; | |
| 6470 | ✗ | Exkey1 = ex1; | |
| 6471 | ✗ | Exkey2 = ex2; | |
| 6472 | ✗ | Exkey3 = ex3; | |
| 6473 | ✗ | Exkey4 = ex4; | |
| 6474 | ✗ | DUkey = du; | |
| 6475 | ✗ | DDkey = dd; | |
| 6476 | ✗ | DLkey = dl; | |
| 6477 | ✗ | DRkey = dr; | |
| 6478 | ✗ | cheat_modifier_keys[0] = mod1a; | |
| 6479 | ✗ | cheat_modifier_keys[1] = mod1b; | |
| 6480 | ✗ | cheat_modifier_keys[2] = mod2a; | |
| 6481 | ✗ | cheat_modifier_keys[3] = mod2b; | |
| 6482 | |||
| 6483 | ✗ | done=true; | |
| 6484 | } | ||
| 6485 | |||
| 6486 | ✗ | rest(1); | |
| 6487 | } | ||
| 6488 | |||
| 6489 | ✗ | return D_O_K; | |
| 6490 | ✗ | } | |
| 6491 | |||
| 6492 | ✗ | int32_t onGamepad() | |
| 6493 | { | ||
| 6494 | ✗ | if (al_get_num_joysticks() == 0) | |
| 6495 | { | ||
| 6496 | ✗ | InfoDialog("ZC", "No gamepads detected.").show(); | |
| 6497 | ✗ | return D_O_K; | |
| 6498 | } | ||
| 6499 | |||
| 6500 | ✗ | int32_t a = Abtn; | |
| 6501 | ✗ | int32_t b = Bbtn; | |
| 6502 | ✗ | int32_t s = Sbtn; | |
| 6503 | ✗ | int32_t l = Lbtn; | |
| 6504 | ✗ | int32_t r = Rbtn; | |
| 6505 | ✗ | int32_t m = Mbtn; | |
| 6506 | ✗ | int32_t p = Pbtn; | |
| 6507 | ✗ | int32_t ex1 = Exbtn1; | |
| 6508 | ✗ | int32_t ex2 = Exbtn2; | |
| 6509 | ✗ | int32_t ex3 = Exbtn3; | |
| 6510 | ✗ | int32_t ex4 = Exbtn4; | |
| 6511 | ✗ | int32_t up = DUbtn; | |
| 6512 | ✗ | int32_t down = DDbtn; | |
| 6513 | ✗ | int32_t left = DLbtn; | |
| 6514 | ✗ | int32_t right = DRbtn; | |
| 6515 | ✗ | int32_t joy = joystick_index; | |
| 6516 | ✗ | int32_t stick_1 = js_stick_1_x_stick; | |
| 6517 | ✗ | int32_t stick_2 = js_stick_2_x_stick; | |
| 6518 | |||
| 6519 | ✗ | gamepad_dlg[0].dp2=get_zc_font(font_lfont); | |
| 6520 | ✗ | if(analog_movement) | |
| 6521 | ✗ | gamepad_dlg[56].flags|=D_SELECTED; | |
| 6522 | else | ||
| 6523 | ✗ | gamepad_dlg[56].flags&=~D_SELECTED; | |
| 6524 | |||
| 6525 | // TODO: should use controller device GUID or name instead of index, otherwise this value is not | ||
| 6526 | // consistent unless exact same number of joysticks is always connected. Name is problematic b/c | ||
| 6527 | // xinput driver doesn't actually get a name (at least, doesn't for my Xbox controller). | ||
| 6528 | // TODO: should store gamepad control mappings per-controller, otherwise switching joystick | ||
| 6529 | // requires remapping every time. | ||
| 6530 | ✗ | if (joystick_index >= al_get_num_joysticks()) | |
| 6531 | ✗ | joystick_index = 0; | |
| 6532 | ✗ | gamepad_dlg[61].d2 = joystick_index; | |
| 6533 | |||
| 6534 | ✗ | gamepad_dlg_cur_joystick = al_get_joystick(joystick_index); | |
| 6535 | ✗ | if (!gamepad_dlg_cur_joystick) | |
| 6536 | { | ||
| 6537 | ✗ | InfoDialog("ZC", "Invalid gamepad. Did it disconnect?").show(); | |
| 6538 | ✗ | return D_CLOSE; | |
| 6539 | } | ||
| 6540 | |||
| 6541 | ✗ | large_dialog(gamepad_dlg); | |
| 6542 | |||
| 6543 | ✗ | int32_t ret = do_zqdialog(gamepad_dlg,4); | |
| 6544 | |||
| 6545 | ✗ | if(ret == 4) //OK | |
| 6546 | { | ||
| 6547 | ✗ | analog_movement = gamepad_dlg[56].flags&D_SELECTED; | |
| 6548 | ✗ | joystick_index = gamepad_dlg[61].d2; | |
| 6549 | ✗ | gamepad_dlg_cur_joystick = al_get_joystick(joystick_index); | |
| 6550 | ✗ | if (!gamepad_dlg_cur_joystick) | |
| 6551 | { | ||
| 6552 | ✗ | InfoDialog("ZC", "Invalid gamepad. Did it disconnect?").show(); | |
| 6553 | ✗ | return D_CLOSE; | |
| 6554 | } | ||
| 6555 | ✗ | js_stick_1_y_stick = js_stick_1_x_stick; | |
| 6556 | ✗ | js_stick_2_y_stick = js_stick_2_x_stick; | |
| 6557 | ✗ | save_control_configs(false); | |
| 6558 | ✗ | } | |
| 6559 | else //Cancel | ||
| 6560 | { | ||
| 6561 | ✗ | Abtn = a; | |
| 6562 | ✗ | Bbtn = b; | |
| 6563 | ✗ | Sbtn = s; | |
| 6564 | ✗ | Lbtn = l; | |
| 6565 | ✗ | Rbtn = r; | |
| 6566 | ✗ | Mbtn = m; | |
| 6567 | ✗ | Pbtn = p; | |
| 6568 | ✗ | Exbtn1 = ex1; | |
| 6569 | ✗ | Exbtn2 = ex2; | |
| 6570 | ✗ | Exbtn3 = ex3; | |
| 6571 | ✗ | Exbtn4 = ex4; | |
| 6572 | ✗ | DUbtn = up; | |
| 6573 | ✗ | DDbtn = down; | |
| 6574 | ✗ | DLbtn = left; | |
| 6575 | ✗ | DRbtn = right; | |
| 6576 | ✗ | joystick_index = joy; | |
| 6577 | ✗ | js_stick_1_x_stick = stick_1; | |
| 6578 | ✗ | js_stick_2_x_stick = stick_2; | |
| 6579 | } | ||
| 6580 | |||
| 6581 | ✗ | return D_O_K; | |
| 6582 | ✗ | } | |
| 6583 | |||
| 6584 | ✗ | int32_t onCheatKeys() | |
| 6585 | { | ||
| 6586 | int32_t oldcheats[Cheat::Last][2]; | ||
| 6587 | ✗ | memcpy(oldcheats, cheatkeys, sizeof(cheatkeys)); | |
| 6588 | |||
| 6589 | ✗ | bool done=false; | |
| 6590 | |||
| 6591 | ✗ | while(!done) | |
| 6592 | { | ||
| 6593 | ✗ | bool confirm = false; | |
| 6594 | ✗ | CheatKeysDialog(&confirm).show(); | |
| 6595 | ✗ | if(confirm) // OK | |
| 6596 | { | ||
| 6597 | ✗ | std::vector<std::string> uniqueError; | |
| 6598 | char buf[512]; | ||
| 6599 | ✗ | for(size_t q = 1; q < Cheat::Last; ++q) | |
| 6600 | { | ||
| 6601 | ✗ | if(cheatkeys[q][1] && !cheatkeys[q][0]) | |
| 6602 | { | ||
| 6603 | ✗ | cheatkeys[q][0] = cheatkeys[q][1]; | |
| 6604 | ✗ | cheatkeys[q][1] = 0; | |
| 6605 | ✗ | } | |
| 6606 | ✗ | } | |
| 6607 | ✗ | for(size_t q = 1; q < Cheat::Last; ++q) | |
| 6608 | { | ||
| 6609 | ✗ | if(!bindable_cheat((Cheat)q)) continue; | |
| 6610 | ✗ | for(size_t p = q+1; p < Cheat::Last; ++p) | |
| 6611 | { | ||
| 6612 | ✗ | if(!bindable_cheat((Cheat)p)) continue; | |
| 6613 | ✗ | for(size_t q2 = 0; q2 <= 1; ++q2) | |
| 6614 | ✗ | for(size_t p2 = 0; p2 <= 1; ++p2) | |
| 6615 | { | ||
| 6616 | ✗ | if(cheatkeys[q][q2] == cheatkeys[p][p2] && cheatkeys[q][q2] != 0) | |
| 6617 | { | ||
| 6618 | ✗ | uniqueError.push_back(fmt::format("'{}' ({}) conflicts with '{}' ({}) - both '{}'", | |
| 6619 | ✗ | cheat_to_string((Cheat)q), q2?"Alt":"Main", | |
| 6620 | ✗ | cheat_to_string((Cheat)p), p2?"Alt":"Main", | |
| 6621 | ✗ | get_keystr(cheatkeys[q][q2]))); | |
| 6622 | ✗ | } | |
| 6623 | ✗ | } | |
| 6624 | ✗ | } | |
| 6625 | ✗ | } | |
| 6626 | ✗ | if(uniqueError.size() == 0) | |
| 6627 | { | ||
| 6628 | ✗ | done = true; | |
| 6629 | ✗ | save_cheatkeys(); | |
| 6630 | ✗ | } | |
| 6631 | else | ||
| 6632 | { | ||
| 6633 | ✗ | box_start(1, "Duplicate Keys", get_zc_font(font_lfont), get_zc_font(font_sfont), false, 500,400, 2); | |
| 6634 | ✗ | box_out("Cannot have duplicate keybinds!"); box_eol(); | |
| 6635 | ✗ | for(std::vector<std::string>::iterator it = uniqueError.begin(); | |
| 6636 | ✗ | it != uniqueError.end(); ++it) | |
| 6637 | { | ||
| 6638 | ✗ | box_out((*it).c_str()); box_eol(); | |
| 6639 | ✗ | } | |
| 6640 | ✗ | box_end(true); | |
| 6641 | } | ||
| 6642 | ✗ | } | |
| 6643 | else // Cancel | ||
| 6644 | { | ||
| 6645 | ✗ | memcpy(cheatkeys, oldcheats, sizeof(cheatkeys)); | |
| 6646 | ✗ | done=true; | |
| 6647 | } | ||
| 6648 | ✗ | rest(1); | |
| 6649 | } | ||
| 6650 | |||
| 6651 | ✗ | return D_O_K; | |
| 6652 | ✗ | } | |
| 6653 | |||
| 6654 | ✗ | int32_t onSound() | |
| 6655 | { | ||
| 6656 | ✗ | if (get_qr(qr_OLD_SCRIPT_VOLUME)) | |
| 6657 | { | ||
| 6658 | ✗ | if (FFCore.coreflags & FFCORE_SCRIPTED_MIDI_VOLUME) | |
| 6659 | { | ||
| 6660 | ✗ | master_volume(-1, ((int32_t)FFCore.usr_midi_volume)); | |
| 6661 | ✗ | } | |
| 6662 | ✗ | if (FFCore.coreflags & FFCORE_SCRIPTED_DIGI_VOLUME) | |
| 6663 | { | ||
| 6664 | ✗ | master_volume((int32_t)(FFCore.usr_digi_volume), 1); | |
| 6665 | ✗ | } | |
| 6666 | ✗ | if (FFCore.coreflags & FFCORE_SCRIPTED_MUSIC_VOLUME) | |
| 6667 | { | ||
| 6668 | ✗ | emusic_volume = (int32_t)FFCore.usr_music_volume; | |
| 6669 | ✗ | } | |
| 6670 | ✗ | if (FFCore.coreflags & FFCORE_SCRIPTED_SFX_VOLUME) | |
| 6671 | { | ||
| 6672 | ✗ | sfx_volume = (int32_t)FFCore.usr_sfx_volume; | |
| 6673 | ✗ | } | |
| 6674 | ✗ | } | |
| 6675 | ✗ | if ( FFCore.coreflags&FFCORE_SCRIPTED_PANSTYLE ) | |
| 6676 | { | ||
| 6677 | ✗ | pan_style = (int32_t)FFCore.usr_panstyle; | |
| 6678 | ✗ | } | |
| 6679 | |||
| 6680 | ✗ | int32_t m = midi_volume; | |
| 6681 | ✗ | int32_t e = emusic_volume; | |
| 6682 | ✗ | int32_t s = sfx_volume; | |
| 6683 | ✗ | int32_t p = pan_style; | |
| 6684 | ✗ | pan_style = vbound(pan_style,0,3); | |
| 6685 | |||
| 6686 | ✗ | sound_dlg[0].dp2=get_zc_font(font_lfont); | |
| 6687 | |||
| 6688 | ✗ | large_dialog(sound_dlg); | |
| 6689 | |||
| 6690 | ✗ | midi_dp[1] = sound_dlg[6].x; | |
| 6691 | ✗ | midi_dp[2] = sound_dlg[6].y; | |
| 6692 | ✗ | emus_dp[1] = sound_dlg[8].x; | |
| 6693 | ✗ | emus_dp[2] = sound_dlg[8].y; | |
| 6694 | ✗ | sfx_dp[1] = sound_dlg[10].x; | |
| 6695 | ✗ | sfx_dp[2] = sound_dlg[10].y; | |
| 6696 | ✗ | pan_dp[1] = sound_dlg[11].x; | |
| 6697 | ✗ | pan_dp[2] = sound_dlg[11].y; | |
| 6698 | ✗ | sound_dlg[15].d2 = (midi_volume==255) ? 32 : midi_volume>>3; | |
| 6699 | ✗ | sound_dlg[17].d2 = (emusic_volume==255) ? 32 : emusic_volume>>3; | |
| 6700 | ✗ | sound_dlg[19].d2 = (sfx_volume==255) ? 32 : sfx_volume>>3; | |
| 6701 | ✗ | sound_dlg[20].d2 = pan_style; | |
| 6702 | |||
| 6703 | ✗ | int32_t ret = do_zqdialog(sound_dlg,1); | |
| 6704 | |||
| 6705 | ✗ | if(ret==2) | |
| 6706 | { | ||
| 6707 | ✗ | master_volume(digi_volume,midi_volume); | |
| 6708 | ✗ | if (zcmusic) | |
| 6709 | ✗ | zcmusic_set_volume(zcmusic, emusic_volume); | |
| 6710 | |||
| 6711 | ✗ | int32_t temp_volume = sfx_volume; | |
| 6712 | ✗ | if (GameLoaded && !get_qr(qr_OLD_SCRIPT_VOLUME)) | |
| 6713 | ✗ | temp_volume = (sfx_volume * FFCore.usr_sfx_volume) / 10000 / 100; | |
| 6714 | ✗ | for(int32_t i=0; i<WAV_COUNT; ++i) | |
| 6715 | { | ||
| 6716 | ✗ | if(sfx_voice[i] >= 0) | |
| 6717 | ✗ | voice_set_volume(sfx_voice[i], temp_volume); | |
| 6718 | ✗ | } | |
| 6719 | ✗ | zc_set_config(sfx_sect,"midi",midi_volume); | |
| 6720 | ✗ | zc_set_config(sfx_sect,"sfx",sfx_volume); | |
| 6721 | ✗ | zc_set_config(sfx_sect,"emusic",emusic_volume); | |
| 6722 | ✗ | zc_set_config(sfx_sect,"pan",pan_style); | |
| 6723 | ✗ | } | |
| 6724 | else | ||
| 6725 | { | ||
| 6726 | ✗ | midi_volume = m; | |
| 6727 | ✗ | emusic_volume = e; | |
| 6728 | ✗ | sfx_volume = s; | |
| 6729 | ✗ | pan_style = p; | |
| 6730 | } | ||
| 6731 | |||
| 6732 | ✗ | return D_O_K; | |
| 6733 | } | ||
| 6734 | |||
| 6735 | ✗ | int32_t queding(char const* s1, char const* s2, char const* s3) | |
| 6736 | { | ||
| 6737 | ✗ | return jwin_alert("ZQuest Classic",s1,s2,s3,"&Yes","&No",'y','n',get_zc_font(font_lfont)); | |
| 6738 | } | ||
| 6739 | |||
| 6740 | ✗ | int32_t onQuit() | |
| 6741 | { | ||
| 6742 | ✗ | if(Playing) | |
| 6743 | { | ||
| 6744 | ✗ | int32_t ret=0; | |
| 6745 | |||
| 6746 | ✗ | if(get_qr(qr_NOCONTINUE)) | |
| 6747 | { | ||
| 6748 | ✗ | if(standalone_mode) | |
| 6749 | { | ||
| 6750 | ✗ | ret=queding("End current game?", | |
| 6751 | "The continue screen is disabled; the game", | ||
| 6752 | "will be reloaded from the last save."); | ||
| 6753 | ✗ | } | |
| 6754 | else | ||
| 6755 | { | ||
| 6756 | ✗ | ret=queding("End current game?", | |
| 6757 | "The continue screen is disabled. You will", | ||
| 6758 | "be returned to the file select screen."); | ||
| 6759 | } | ||
| 6760 | ✗ | } | |
| 6761 | else | ||
| 6762 | ✗ | ret=queding("End current game?",NULL,NULL); | |
| 6763 | |||
| 6764 | ✗ | if(ret==1) | |
| 6765 | { | ||
| 6766 | ✗ | disableClickToFreeze=false; | |
| 6767 | ✗ | Quit=qQUIT; | |
| 6768 | |||
| 6769 | // Trying to evade a door repair charge? | ||
| 6770 | ✗ | if(repaircharge) | |
| 6771 | { | ||
| 6772 | ✗ | game->change_drupy(-repaircharge); | |
| 6773 | ✗ | repaircharge=0; | |
| 6774 | ✗ | } | |
| 6775 | |||
| 6776 | ✗ | return D_CLOSE; | |
| 6777 | } | ||
| 6778 | ✗ | } | |
| 6779 | |||
| 6780 | ✗ | return D_O_K; | |
| 6781 | ✗ | } | |
| 6782 | |||
| 6783 | ✗ | int32_t onTryQuitMenu() | |
| 6784 | { | ||
| 6785 | ✗ | return onTryQuit(true); | |
| 6786 | } | ||
| 6787 | |||
| 6788 | ✗ | int32_t onTryQuit(bool inMenu) | |
| 6789 | { | ||
| 6790 | ✗ | if(Playing && !(GameFlags & GAMEFLAG_NO_F6)) | |
| 6791 | { | ||
| 6792 | ✗ | if(active_cutscene.can_f6()) | |
| 6793 | { | ||
| 6794 | ✗ | if(get_qr(qr_OLD_F6)) | |
| 6795 | { | ||
| 6796 | ✗ | if(inMenu) onQuit(); | |
| 6797 | ✗ | else /*if(!get_qr(qr_NOCONTINUE))*/ f_Quit(qQUIT); | |
| 6798 | ✗ | } | |
| 6799 | else | ||
| 6800 | { | ||
| 6801 | ✗ | disableClickToFreeze=false; | |
| 6802 | ✗ | GameFlags |= GAMEFLAG_TRYQUIT; | |
| 6803 | } | ||
| 6804 | ✗ | return D_CLOSE; | |
| 6805 | } | ||
| 6806 | ✗ | else active_cutscene.error(); | |
| 6807 | ✗ | } | |
| 6808 | |||
| 6809 | ✗ | return D_O_K; | |
| 6810 | ✗ | } | |
| 6811 | |||
| 6812 | ✗ | int32_t onReset() | |
| 6813 | { | ||
| 6814 | ✗ | if(queding(" Reset system? ",NULL,NULL)==1) | |
| 6815 | { | ||
| 6816 | ✗ | disableClickToFreeze=false; | |
| 6817 | ✗ | Quit=qRESET; | |
| 6818 | ✗ | replay_quit(); | |
| 6819 | ✗ | return D_CLOSE; | |
| 6820 | } | ||
| 6821 | |||
| 6822 | ✗ | return D_O_K; | |
| 6823 | ✗ | } | |
| 6824 | |||
| 6825 | ✗ | int32_t onExit() | |
| 6826 | { | ||
| 6827 | ✗ | if(queding(" Quit ZQuest Classic? ",NULL,NULL)==1) | |
| 6828 | { | ||
| 6829 | ✗ | Quit=qEXIT; | |
| 6830 | ✗ | return D_CLOSE; | |
| 6831 | } | ||
| 6832 | |||
| 6833 | ✗ | return D_O_K; | |
| 6834 | ✗ | } | |
| 6835 | |||
| 6836 | ✗ | int32_t onDebug() | |
| 6837 | { | ||
| 6838 | ✗ | if(debug_enabled) | |
| 6839 | ✗ | set_debug(!get_debug()); | |
| 6840 | ✗ | return D_O_K; | |
| 6841 | } | ||
| 6842 | |||
| 6843 | ✗ | int32_t onHeartBeep() | |
| 6844 | { | ||
| 6845 | ✗ | heart_beep=!heart_beep; | |
| 6846 | ✗ | zc_set_config(cfg_sect,"heart_beep",heart_beep); | |
| 6847 | ✗ | return D_O_K; | |
| 6848 | } | ||
| 6849 | |||
| 6850 | ✗ | int32_t onSaveIndicator() | |
| 6851 | { | ||
| 6852 | ✗ | use_save_indicator = use_save_indicator ? 0 : 1; | |
| 6853 | ✗ | zc_set_config(cfg_sect,"save_indicator",use_save_indicator); | |
| 6854 | ✗ | return D_O_K; | |
| 6855 | } | ||
| 6856 | |||
| 6857 | ✗ | int32_t onEpilepsy() | |
| 6858 | { | ||
| 6859 | ✗ | if(jwin_alert3( | |
| 6860 | "Epilepsy Flash Reduction", | ||
| 6861 | "Enabling this will reduce the intensity of flashing and screen wave effects.", | ||
| 6862 | "Disabling this will restore standard flash and wavy behaviour.", | ||
| 6863 | "Proceed?", | ||
| 6864 | "&Yes", | ||
| 6865 | "&No", | ||
| 6866 | NULL, | ||
| 6867 | 'y', | ||
| 6868 | 'n', | ||
| 6869 | 0, | ||
| 6870 | ✗ | get_zc_font(font_lfont)) == 1) | |
| 6871 | { | ||
| 6872 | ✗ | epilepsyFlashReduction = epilepsyFlashReduction ? 0 : 1; | |
| 6873 | ✗ | zc_set_config(cfg_sect,"epilepsy_flash_reduction",epilepsyFlashReduction); | |
| 6874 | ✗ | } | |
| 6875 | ✗ | return D_O_K; | |
| 6876 | } | ||
| 6877 | |||
| 6878 | bool rc = false; | ||
| 6879 | |||
| 6880 | static DIALOG getnum_dlg[] = | ||
| 6881 | { | ||
| 6882 | // (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) | ||
| 6883 | { jwin_win_proc, 80, 80, 160, 72, vc(0), vc(11), 0, D_EXIT, 0, 0, NULL, NULL, NULL }, | ||
| 6884 | { jwin_text_proc, 104, 104+4, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Number:", NULL, NULL }, | ||
| 6885 | { jwin_edit_proc, 168, 104, 48, 16, 0, 0, 0, 0, 6, 0, NULL, NULL, NULL }, | ||
| 6886 | { jwin_button_proc, 90, 126, 61, 21, vc(0), vc(11), 13, D_EXIT, 0, 0, (void *) "OK", NULL, NULL }, | ||
| 6887 | { jwin_button_proc, 170, 126, 61, 21, vc(0), vc(11), 27, D_EXIT, 0, 0, (void *) "Cancel", NULL, NULL }, | ||
| 6888 | { d_timer_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 6889 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } | ||
| 6890 | }; | ||
| 6891 | |||
| 6892 | ✗ | int32_t getnumber(const char *prompt,int32_t initialval) | |
| 6893 | { | ||
| 6894 | char buf[20]; | ||
| 6895 | ✗ | sprintf(buf,"%d",initialval); | |
| 6896 | ✗ | getnum_dlg[0].dp=(void *)prompt; | |
| 6897 | ✗ | getnum_dlg[0].dp2=get_zc_font(font_lfont); | |
| 6898 | ✗ | getnum_dlg[2].dp=buf; | |
| 6899 | |||
| 6900 | ✗ | large_dialog(getnum_dlg); | |
| 6901 | |||
| 6902 | ✗ | if(do_zqdialog(getnum_dlg,2)==3) | |
| 6903 | ✗ | return atoi(buf); | |
| 6904 | |||
| 6905 | ✗ | return initialval; | |
| 6906 | ✗ | } | |
| 6907 | |||
| 6908 | ✗ | int32_t onLife() | |
| 6909 | { | ||
| 6910 | ✗ | int value = vbound(getnumber("Life",game->get_life()),1,game->get_maxlife()); | |
| 6911 | ✗ | cheats_enqueue(Cheat::Life, value); | |
| 6912 | ✗ | return D_O_K; | |
| 6913 | ✗ | } | |
| 6914 | |||
| 6915 | ✗ | int32_t onHeartC() | |
| 6916 | { | ||
| 6917 | ✗ | int max_life = vbound(getnumber("Heart Containers",game->get_maxlife()/game->get_hp_per_heart()),1,4095) * game->get_hp_per_heart(); | |
| 6918 | ✗ | int life = vbound(getnumber("Life",game->get_life()/game->get_hp_per_heart()),1,max_life/game->get_hp_per_heart())*game->get_hp_per_heart(); | |
| 6919 | ✗ | cheats_enqueue(Cheat::MaxLife, max_life); | |
| 6920 | ✗ | cheats_enqueue(Cheat::Life, life); | |
| 6921 | ✗ | return D_O_K; | |
| 6922 | ✗ | } | |
| 6923 | |||
| 6924 | ✗ | int32_t onMagicC() | |
| 6925 | { | ||
| 6926 | ✗ | int max_magic = vbound(getnumber("Magic Containers",game->get_maxmagic()/game->get_mp_per_block()),0,2047) * game->get_mp_per_block(); | |
| 6927 | ✗ | int magic = vbound(getnumber("Magic",game->get_magic()/game->get_mp_per_block()),0,max_magic/game->get_mp_per_block())*game->get_mp_per_block(); | |
| 6928 | ✗ | cheats_enqueue(Cheat::MaxMagic, max_magic); | |
| 6929 | ✗ | cheats_enqueue(Cheat::Magic, magic); | |
| 6930 | ✗ | return D_O_K; | |
| 6931 | ✗ | } | |
| 6932 | |||
| 6933 | ✗ | int32_t onRupies() | |
| 6934 | { | ||
| 6935 | ✗ | int value = vbound(getnumber("Rupees",game->get_rupies()),0,game->get_maxcounter(1)); | |
| 6936 | ✗ | cheats_enqueue(Cheat::Rupies, value); | |
| 6937 | ✗ | return D_O_K; | |
| 6938 | ✗ | } | |
| 6939 | |||
| 6940 | ✗ | int32_t onMaxBombs() | |
| 6941 | { | ||
| 6942 | ✗ | int value = vbound(getnumber("Max Bombs",game->get_maxbombs()),0,0xFFFF); | |
| 6943 | ✗ | cheats_enqueue(Cheat::MaxBombs, value); | |
| 6944 | ✗ | cheats_enqueue(Cheat::Bombs, value); | |
| 6945 | ✗ | return D_O_K; | |
| 6946 | ✗ | } | |
| 6947 | |||
| 6948 | ✗ | int32_t onRefillLife() | |
| 6949 | { | ||
| 6950 | ✗ | cheats_enqueue(Cheat::Life, game->get_maxlife()); | |
| 6951 | ✗ | return D_O_K; | |
| 6952 | ✗ | } | |
| 6953 | ✗ | int32_t onRefillMagic() | |
| 6954 | { | ||
| 6955 | ✗ | cheats_enqueue(Cheat::Magic, game->get_maxmagic()); | |
| 6956 | ✗ | return D_O_K; | |
| 6957 | ✗ | } | |
| 6958 | ✗ | int32_t onClock() | |
| 6959 | { | ||
| 6960 | ✗ | cheats_enqueue(Cheat::Clock); | |
| 6961 | ✗ | return D_O_K; | |
| 6962 | ✗ | } | |
| 6963 | |||
| 6964 | ✗ | int32_t onQstPath() | |
| 6965 | { | ||
| 6966 | char initial_path[2048]; | ||
| 6967 | ✗ | chop_path(qstdir); | |
| 6968 | ✗ | strcpy(initial_path, qstdir); | |
| 6969 | |||
| 6970 | ✗ | if (auto result = prompt_for_existing_folder("Quest File Directory", initial_path, "qst")) | |
| 6971 | { | ||
| 6972 | ✗ | char* path = result->data(); | |
| 6973 | ✗ | chop_path(path); | |
| 6974 | ✗ | fix_filename_case(path); | |
| 6975 | ✗ | fix_filename_slashes(path); | |
| 6976 | ✗ | strcpy(qstdir,path); | |
| 6977 | ✗ | strcpy(qstpath,qstdir); | |
| 6978 | ✗ | zc_set_config("zeldadx","quest_dir",qstdir); | |
| 6979 | ✗ | flush_config_file(); | |
| 6980 | ✗ | } | |
| 6981 | |||
| 6982 | ✗ | return D_O_K; | |
| 6983 | ✗ | } | |
| 6984 | |||
| 6985 | #include "dialog/cheat_dialog.h" | ||
| 6986 | ✗ | int32_t onCheat() | |
| 6987 | { | ||
| 6988 | ✗ | call_setcheat_dialog(); | |
| 6989 | ✗ | game->set_cheat(maxcheat); | |
| 6990 | ✗ | if(cheat) game->did_cheat(true); | |
| 6991 | ✗ | return D_O_K; | |
| 6992 | } | ||
| 6993 | |||
| 6994 | ✗ | int32_t onCheatRupies() | |
| 6995 | { | ||
| 6996 | ✗ | cheats_enqueue(Cheat::Rupies, game->get_maxcounter(1)); | |
| 6997 | ✗ | return D_O_K; | |
| 6998 | ✗ | } | |
| 6999 | |||
| 7000 | ✗ | int32_t onCheatArrows() | |
| 7001 | { | ||
| 7002 | ✗ | cheats_enqueue(Cheat::Arrows, game->get_maxarrows()); | |
| 7003 | ✗ | return D_O_K; | |
| 7004 | ✗ | } | |
| 7005 | |||
| 7006 | ✗ | int32_t onCheatBombs() | |
| 7007 | { | ||
| 7008 | ✗ | cheats_enqueue(Cheat::Bombs, game->get_maxbombs(), game->get_maxcounter(6)); | |
| 7009 | ✗ | return D_O_K; | |
| 7010 | ✗ | } | |
| 7011 | |||
| 7012 | // *** screen saver | ||
| 7013 | |||
| 7014 | 18325316 | int32_t after_time() | |
| 7015 | { | ||
| 7016 |
1/2✓ Branch 0 taken 18325316 times.
✗ Branch 1 not taken.
|
18325316 | if(ss_enable == 0) |
| 7017 | ✗ | return INT_MAX; | |
| 7018 | |||
| 7019 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18325316 times.
|
18325316 | if(ss_after <= 0) |
| 7020 | ✗ | return 5 * 60; | |
| 7021 | |||
| 7022 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18325316 times.
|
18325316 | if(ss_after <= 3) |
| 7023 | ✗ | return ss_after * 15 * 60; | |
| 7024 | |||
| 7025 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18325316 times.
|
18325316 | if(ss_after <= 13) |
| 7026 | ✗ | return (ss_after - 3) * 60 * 60; | |
| 7027 | |||
| 7028 | 18325316 | return MAX_IDLE + 1; | |
| 7029 | 18325316 | } | |
| 7030 | |||
| 7031 | static const char *after_str[15] = | ||
| 7032 | { | ||
| 7033 | " 5 sec", "15 sec", "30 sec", "45 sec", " 1 min", " 2 min", " 3 min", | ||
| 7034 | " 4 min", " 5 min", " 6 min", " 7 min", " 8 min", " 9 min", "10 min", | ||
| 7035 | "Never" | ||
| 7036 | }; | ||
| 7037 | |||
| 7038 | ✗ | const char *after_list(int32_t index, int32_t *list_size) | |
| 7039 | { | ||
| 7040 | ✗ | if(index < 0) | |
| 7041 | { | ||
| 7042 | ✗ | *list_size = 15; | |
| 7043 | ✗ | return NULL; | |
| 7044 | } | ||
| 7045 | |||
| 7046 | ✗ | return after_str[index]; | |
| 7047 | ✗ | } | |
| 7048 | |||
| 7049 | 356 | static ListData after__list(after_list, &font); | |
| 7050 | |||
| 7051 | static DIALOG scrsaver_dlg[] = | ||
| 7052 | { | ||
| 7053 | /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */ | ||
| 7054 | 356 | { jwin_win_proc, 32, 64, 256, 136, 0, 0, 0, D_EXIT, 0, 0, (void *) "Screen Saver Settings", NULL, NULL }, | |
| 7055 | 356 | { jwin_frame_proc, 42, 92, 236, 70, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | |
| 7056 | 356 | { jwin_text_proc, 60, 104, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Run After", NULL, NULL }, | |
| 7057 | 356 | { jwin_text_proc, 60, 128, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Speed", NULL, NULL }, | |
| 7058 | 356 | { jwin_text_proc, 60, 144, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Density", NULL, NULL }, | |
| 7059 | 356 | { jwin_droplist_proc, 144, 100, 96, 16, 0, 0, 0, 0, 0, 0, (void *) &after__list, NULL, NULL }, | |
| 7060 | 356 | { jwin_slider_proc, 144, 128, 116, 8, vc(0), jwin_pal[jcBOX], 0, 0, 6, 0, NULL, NULL, NULL }, | |
| 7061 | 356 | { jwin_slider_proc, 144, 144, 116, 8, vc(0), jwin_pal[jcBOX], 0, 0, 6, 0, NULL, NULL, NULL }, | |
| 7062 | 356 | { jwin_button_proc, 42, 170, 61, 21, 0, 0, 0, D_EXIT, 0, 0, (void *) "OK", NULL, NULL }, | |
| 7063 | 356 | { jwin_button_proc, 124, 170, 72, 21, 0, 0, 0, D_EXIT, 0, 0, (void *) "Preview", NULL, NULL }, | |
| 7064 | 356 | { jwin_button_proc, 218, 170, 61, 21, 0, 0, 0, D_EXIT, 0, 0, (void *) "Cancel", NULL, NULL }, | |
| 7065 | 356 | { d_timer_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 7066 | 356 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } | |
| 7067 | }; | ||
| 7068 | |||
| 7069 | ✗ | int32_t onScreenSaver() | |
| 7070 | { | ||
| 7071 | ✗ | scrsaver_dlg[0].dp2=get_zc_font(font_lfont); | |
| 7072 | int32_t oldcfgs[3]; | ||
| 7073 | ✗ | scrsaver_dlg[5].d1 = scrsaver_dlg[5].d2 = oldcfgs[0] = ss_after; | |
| 7074 | ✗ | scrsaver_dlg[6].d2 = oldcfgs[1] = ss_speed; | |
| 7075 | ✗ | scrsaver_dlg[7].d2 = oldcfgs[2] = ss_density; | |
| 7076 | |||
| 7077 | ✗ | large_dialog(scrsaver_dlg); | |
| 7078 | |||
| 7079 | ✗ | int32_t ret = do_zqdialog(scrsaver_dlg,-1); | |
| 7080 | |||
| 7081 | ✗ | if(ret == 8 || ret == 9) | |
| 7082 | { | ||
| 7083 | ✗ | ss_after = scrsaver_dlg[5].d1; | |
| 7084 | ✗ | ss_speed = scrsaver_dlg[6].d2; | |
| 7085 | ✗ | ss_density = scrsaver_dlg[7].d2; | |
| 7086 | ✗ | if(oldcfgs[0] != ss_after) | |
| 7087 | ✗ | zc_set_config(cfg_sect,"ss_after",ss_after); | |
| 7088 | ✗ | if(oldcfgs[1] != ss_speed) | |
| 7089 | ✗ | zc_set_config(cfg_sect,"ss_speed",ss_speed); | |
| 7090 | ✗ | if(oldcfgs[2] != ss_density) | |
| 7091 | ✗ | zc_set_config(cfg_sect,"ss_density",ss_density); | |
| 7092 | ✗ | } | |
| 7093 | |||
| 7094 | ✗ | if(ret == 9) | |
| 7095 | // preview Screen Saver | ||
| 7096 | { | ||
| 7097 | ✗ | clear_keybuf(); | |
| 7098 | ✗ | Matrix(ss_speed, ss_density, 30); | |
| 7099 | ✗ | system_pal(true); | |
| 7100 | ✗ | sys_mouse(); | |
| 7101 | ✗ | } | |
| 7102 | |||
| 7103 | ✗ | return D_O_K; | |
| 7104 | } | ||
| 7105 | |||
| 7106 | /***** Menus *****/ | ||
| 7107 | |||
| 7108 | enum | ||
| 7109 | { | ||
| 7110 | MENUID_GAME_LOADQUEST, | ||
| 7111 | MENUID_GAME_ENDGAME, | ||
| 7112 | }; | ||
| 7113 |
1/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
356 | static NewMenu game_menu |
| 7114 | 2848 | { | |
| 7115 |
3/6✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 356 times.
✗ Branch 5 not taken.
|
356 | { "&Continue","ESC", onContinue }, |
| 7116 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | {}, |
| 7117 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "L&oad Quest...", onCustomGame, MENUID_GAME_LOADQUEST }, |
| 7118 |
3/6✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 356 times.
✗ Branch 5 not taken.
|
356 | { "&End Game","F6", onTryQuitMenu, MENUID_GAME_ENDGAME }, |
| 7119 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | {}, |
| 7120 | #ifdef __EMSCRIPTEN__ | ||
| 7121 | { "&Reset","F7", onReset }, | ||
| 7122 | #elif defined(ALLEGRO_MACOSX) | ||
| 7123 | { "&Reset","F7", onReset }, | ||
| 7124 | { "&Quit","F8", onExit }, | ||
| 7125 | #else | ||
| 7126 |
3/6✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 356 times.
✗ Branch 5 not taken.
|
356 | { "&Reset","F9", onReset }, |
| 7127 |
3/6✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 356 times.
✗ Branch 5 not taken.
|
356 | { "&Quit","F10", onExit }, |
| 7128 | #endif | ||
| 7129 | }; | ||
| 7130 | |||
| 7131 |
1/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
356 | static NewMenu snapshot_format_menu |
| 7132 | 2492 | { | |
| 7133 |
4/8✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 356 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 356 times.
✗ Branch 7 not taken.
|
356 | { "&BMP", std::bind(onSetSnapshotFormat, ssfmtBMP) }, |
| 7134 |
4/8✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 356 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 356 times.
✗ Branch 7 not taken.
|
356 | { "&GIF", std::bind(onSetSnapshotFormat, ssfmtGIF) }, |
| 7135 |
4/8✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 356 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 356 times.
✗ Branch 7 not taken.
|
356 | { "&JPG", std::bind(onSetSnapshotFormat, ssfmtJPG) }, |
| 7136 |
4/8✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 356 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 356 times.
✗ Branch 7 not taken.
|
356 | { "&PNG", std::bind(onSetSnapshotFormat, ssfmtPNG) }, |
| 7137 |
4/8✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 356 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 356 times.
✗ Branch 7 not taken.
|
356 | { "PC&X", std::bind(onSetSnapshotFormat, ssfmtPCX) }, |
| 7138 |
4/8✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 356 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 356 times.
✗ Branch 7 not taken.
|
356 | { "&TGA", std::bind(onSetSnapshotFormat, ssfmtTGA) }, |
| 7139 | }; | ||
| 7140 | |||
| 7141 |
1/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
356 | static NewMenu controls_menu |
| 7142 | 1424 | { | |
| 7143 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Key&board...", onKeyboard }, |
| 7144 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "&Gamepad...", onGamepad }, |
| 7145 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "&Cheat Keys...", onCheatKeys }, |
| 7146 | }; | ||
| 7147 | |||
| 7148 |
1/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
356 | static NewMenu name_entry_mode_menu |
| 7149 | 1424 | { | |
| 7150 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "&Keyboard", onKeyboardEntry }, |
| 7151 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "&Letter Grid", onLetterGridEntry }, |
| 7152 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "&Extended Letter Grid", onExtLetterGridEntry }, |
| 7153 | }; | ||
| 7154 | |||
| 7155 | static void set_controls_menu_active() | ||
| 7156 | { | ||
| 7157 | |||
| 7158 | } | ||
| 7159 | |||
| 7160 | enum | ||
| 7161 | { | ||
| 7162 | MENUID_WINDOW_LOCK_ASPECT, | ||
| 7163 | MENUID_WINDOW_LOCK_INTSCALE, | ||
| 7164 | MENUID_WINDOW_SAVE_SIZE, | ||
| 7165 | MENUID_WINDOW_SAVE_POS, | ||
| 7166 | MENUID_WINDOW_STRETCH, | ||
| 7167 | }; | ||
| 7168 |
1/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
356 | static NewMenu window_menu |
| 7169 | 2136 | { | |
| 7170 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Lock Aspect Ratio", onDragAspect, MENUID_WINDOW_LOCK_ASPECT }, |
| 7171 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Lock Integer Scale", onIntegerScaling, MENUID_WINDOW_LOCK_INTSCALE }, |
| 7172 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Save Size Changes", onSaveDragResize, MENUID_WINDOW_SAVE_SIZE }, |
| 7173 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Save Position Changes", onWinPosSave, MENUID_WINDOW_SAVE_POS }, |
| 7174 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Stretch Game Area", onStretchGame, MENUID_WINDOW_STRETCH }, |
| 7175 | }; | ||
| 7176 | void call_zc_options_dlg(); | ||
| 7177 | enum | ||
| 7178 | { | ||
| 7179 | MENUID_OPTIONS_PAUSE_BG, | ||
| 7180 | MENUID_OPTIONS_EPILEPSYPROT, | ||
| 7181 | }; | ||
| 7182 |
1/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
356 | static NewMenu options_menu |
| 7183 | 2492 | { | |
| 7184 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Name &Entry Mode", &name_entry_mode_menu }, |
| 7185 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "S&napshot Format", &snapshot_format_menu }, |
| 7186 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "&Window Settings", &window_menu }, |
| 7187 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Epilepsy Flash Reduction", onEpilepsy, MENUID_OPTIONS_EPILEPSYPROT }, |
| 7188 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Pause In Background", onPauseInBackground, MENUID_OPTIONS_PAUSE_BG }, |
| 7189 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "More Options", call_zc_options_dlg }, |
| 7190 | }; | ||
| 7191 | enum | ||
| 7192 | { | ||
| 7193 | MENUID_SETTINGS_CONTROLS, | ||
| 7194 | MENUID_SETTINGS_CAPFPS, | ||
| 7195 | MENUID_SETTINGS_SHOWFPS, | ||
| 7196 | MENUID_SETTINGS_SHOWTIME, | ||
| 7197 | MENUID_SETTINGS_CLICK_FREEZE, | ||
| 7198 | MENUID_SETTINGS_TRANSLAYERS, | ||
| 7199 | MENUID_SETTINGS_NESQUIT, | ||
| 7200 | MENUID_SETTINGS_VOLKEYS, | ||
| 7201 | MENUID_SETTINGS_HEARTBEEP, | ||
| 7202 | MENUID_SETTINGS_SAVEINDICATOR, | ||
| 7203 | MENUID_SETTINGS_DEBUG, | ||
| 7204 | }; | ||
| 7205 |
1/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
356 | static NewMenu settings_menu |
| 7206 | 6052 | { | |
| 7207 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "&Sound...", onSound }, |
| 7208 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "C&ontrols", &controls_menu, MENUID_SETTINGS_CONTROLS }, |
| 7209 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | {}, |
| 7210 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Options", &options_menu }, |
| 7211 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | {}, |
| 7212 |
3/6✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 356 times.
✗ Branch 5 not taken.
|
356 | { "&Cap FPS","F1", onThrottleFPS, MENUID_SETTINGS_CAPFPS }, |
| 7213 |
3/6✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 356 times.
✗ Branch 5 not taken.
|
356 | { "Show &FPS","F2", onShowFPS, MENUID_SETTINGS_SHOWFPS }, |
| 7214 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Show &Time", onShowTime, MENUID_SETTINGS_SHOWTIME }, |
| 7215 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Click to Freeze", onClickToFreeze, MENUID_SETTINGS_CLICK_FREEZE }, |
| 7216 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Cont. &Heart Beep", onHeartBeep, MENUID_SETTINGS_HEARTBEEP }, |
| 7217 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Show Trans. &Layers", onTransLayers, MENUID_SETTINGS_TRANSLAYERS }, |
| 7218 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Up+A+B To &Quit", onNESquit, MENUID_SETTINGS_NESQUIT }, |
| 7219 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Volume &Keys", onVolKeys, MENUID_SETTINGS_VOLKEYS }, |
| 7220 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Sa&ve Indicator", onSaveIndicator, MENUID_SETTINGS_SAVEINDICATOR }, |
| 7221 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | {}, |
| 7222 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Debu&g", onDebug, MENUID_SETTINGS_DEBUG }, |
| 7223 | }; | ||
| 7224 | |||
| 7225 | enum | ||
| 7226 | { | ||
| 7227 | MENUID_MISC_FULLSCREEN, | ||
| 7228 | MENUID_MISC_VIDMODE, | ||
| 7229 | MENUID_MISC_QUEST_INFO, | ||
| 7230 | MENUID_MISC_QUEST_DIR, | ||
| 7231 | MENUID_MISC_CONSOLE, | ||
| 7232 | MENUID_MISC_CLEAR_CONSOLE_ON_LOAD, | ||
| 7233 | }; | ||
| 7234 |
1/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
356 | static NewMenu misc_menu |
| 7235 | 5340 | { | |
| 7236 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "&About...", onAbout }, |
| 7237 | // TODO: re-enable, but: 1) do not use a bitmap thing that is hard to update 2) update names and 3) don't use the Z-word. | ||
| 7238 | // { "&Credits...", onCredits }, | ||
| 7239 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "&Fullscreen", onFullscreenMenu, MENUID_MISC_FULLSCREEN }, |
| 7240 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "&Video Mode...", onVidMode, MENUID_MISC_VIDMODE }, |
| 7241 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | {}, |
| 7242 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "&Quest Info...", onQuest, MENUID_MISC_QUEST_INFO }, |
| 7243 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Quest &MIDI Info...", onMIDICredits }, |
| 7244 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Quest &Directory...", onQstPath, MENUID_MISC_QUEST_DIR }, |
| 7245 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | {}, |
| 7246 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Take &Snapshot F12", onSnapshot }, |
| 7247 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Sc&reen Saver...", onScreenSaver }, |
| 7248 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Save ZC Configuration", OnSaveZCConfig }, |
| 7249 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Show Console", onConsole, MENUID_MISC_CONSOLE }, |
| 7250 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Clear Console on Qst Load", onClrConsoleOnLoad, MENUID_MISC_CLEAR_CONSOLE_ON_LOAD }, |
| 7251 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Clear Directory Cache", OnnClearQuestDir }, |
| 7252 | }; | ||
| 7253 | |||
| 7254 | enum | ||
| 7255 | { | ||
| 7256 | MENUID_REFILL_ARROWS, | ||
| 7257 | }; | ||
| 7258 |
1/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
356 | static NewMenu refill_menu |
| 7259 | 2136 | { | |
| 7260 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "&Life", onRefillLife }, |
| 7261 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "&Magic", onRefillMagic }, |
| 7262 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "&Bombs", onCheatBombs }, |
| 7263 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "&Rupees", onCheatRupies }, |
| 7264 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "&Arrows", onCheatArrows, MENUID_REFILL_ARROWS }, |
| 7265 | }; | ||
| 7266 | |||
| 7267 | enum | ||
| 7268 | { | ||
| 7269 | MENUID_SHOW_L0, | ||
| 7270 | MENUID_SHOW_L1, | ||
| 7271 | MENUID_SHOW_L2, | ||
| 7272 | MENUID_SHOW_L3, | ||
| 7273 | MENUID_SHOW_L4, | ||
| 7274 | MENUID_SHOW_L5, | ||
| 7275 | MENUID_SHOW_L6, | ||
| 7276 | MENUID_SHOW_OVER, | ||
| 7277 | MENUID_SHOW_PUSH, | ||
| 7278 | MENUID_SHOW_FFC, | ||
| 7279 | MENUID_SHOW_SPR, | ||
| 7280 | MENUID_SHOW_SCRIPTNAME, | ||
| 7281 | MENUID_SHOW_SOLIDITY, | ||
| 7282 | MENUID_SHOW_HITBOX, | ||
| 7283 | MENUID_SHOW_EFFECT, | ||
| 7284 | }; | ||
| 7285 |
1/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
356 | static NewMenu show_menu |
| 7286 | 6764 | { | |
| 7287 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Combos", onShowLayer0, MENUID_SHOW_L0 }, |
| 7288 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Layer 1", onShowLayer1, MENUID_SHOW_L1 }, |
| 7289 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Layer 2", onShowLayer2, MENUID_SHOW_L2 }, |
| 7290 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Layer 3", onShowLayer3, MENUID_SHOW_L3 }, |
| 7291 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Layer 4", onShowLayer4, MENUID_SHOW_L4 }, |
| 7292 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Layer 5", onShowLayer5, MENUID_SHOW_L5 }, |
| 7293 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Layer 6", onShowLayer6, MENUID_SHOW_L6 }, |
| 7294 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Overhead Combos", onShowLayerO, MENUID_SHOW_OVER }, |
| 7295 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Push Blocks", onShowLayerP, MENUID_SHOW_PUSH }, |
| 7296 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Freeform Combos", onShowLayerF, MENUID_SHOW_FFC }, |
| 7297 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Sprites", onShowLayerS, MENUID_SHOW_SPR }, |
| 7298 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | {}, |
| 7299 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Current FFC Scripts", onShowFFScripts, MENUID_SHOW_SCRIPTNAME }, |
| 7300 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | {}, |
| 7301 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Walkability", onShowLayerW, MENUID_SHOW_SOLIDITY }, |
| 7302 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Hitboxes", onShowHitboxes, MENUID_SHOW_HITBOX }, |
| 7303 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Effects", onShowLayerE, MENUID_SHOW_EFFECT }, |
| 7304 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Info Opacity", onShowInfoOpacity }, |
| 7305 | }; | ||
| 7306 | |||
| 7307 | enum | ||
| 7308 | { | ||
| 7309 | MENUID_CHEAT_CHOP_L1, | ||
| 7310 | MENUID_CHEAT_CHOP_L2, | ||
| 7311 | MENUID_CHEAT_CHOP_L3, | ||
| 7312 | MENUID_CHEAT_CHOP_L4, | ||
| 7313 | MENUID_CHEAT_INVULN, | ||
| 7314 | MENUID_CHEAT_NOCLIP, | ||
| 7315 | MENUID_CHEAT_IGNORESV, | ||
| 7316 | MENUID_CHEAT_GOFAST, | ||
| 7317 | }; | ||
| 7318 |
1/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
356 | static NewMenu cheat_menu |
| 7319 | 6052 | { | |
| 7320 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Set &Cheat", onCheat }, |
| 7321 |
1/2✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
|
356 | { MENUID_CHEAT_CHOP_L1 }, |
| 7322 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Re&fill", &refill_menu }, |
| 7323 |
1/2✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
|
356 | { MENUID_CHEAT_CHOP_L2 }, |
| 7324 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "&Invincible", onClock, MENUID_CHEAT_INVULN }, |
| 7325 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Ma&x Bombs...", onMaxBombs }, |
| 7326 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "&Heart Containers...", onHeartC }, |
| 7327 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "&Magic Containers...", onMagicC }, |
| 7328 |
1/2✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
|
356 | { MENUID_CHEAT_CHOP_L3 }, |
| 7329 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "&Player Data...", onCheatConsole }, |
| 7330 |
1/2✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
|
356 | { MENUID_CHEAT_CHOP_L4 }, |
| 7331 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Walk Through &Walls", onNoWalls, MENUID_CHEAT_NOCLIP }, |
| 7332 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Player Ignores Side&view", onIgnoreSideview, MENUID_CHEAT_IGNORESV }, |
| 7333 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "&Quick Movement", onGoFast, MENUID_CHEAT_GOFAST }, |
| 7334 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "&Kill All Enemies", onKillCheat }, |
| 7335 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Trigger &Secrets", onSecretsCheat }, |
| 7336 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Trigger Secrets Perm", onSecretsCheatPerm }, |
| 7337 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Show/Hide Layer", &show_menu }, |
| 7338 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "Toggle &Light", onLightSwitch }, |
| 7339 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "&Goto Location...", onGoTo }, |
| 7340 | }; | ||
| 7341 | |||
| 7342 | #if DEVLEVEL > 0 | ||
| 7343 | int32_t devLogging(); | ||
| 7344 | int32_t devDebug(); | ||
| 7345 | int32_t devTimestmp(); | ||
| 7346 | #if DEVLEVEL > 1 | ||
| 7347 | int32_t setCheat(); | ||
| 7348 | #endif //DEVLEVEL > 1 | ||
| 7349 | enum | ||
| 7350 | { | ||
| 7351 | MENUID_DEV_LOGGING, | ||
| 7352 | MENUID_DEV_DEBUG, | ||
| 7353 | MENUID_DEV_TIMESTAMP, | ||
| 7354 | MENUID_DEV_SETCHEAT, | ||
| 7355 | }; | ||
| 7356 | static NewMenu dev_menu | ||
| 7357 | { | ||
| 7358 | { "&Force Error Log", devLogging, MENUID_DEV_LOGGING }, | ||
| 7359 | // { "&Extra Debug Log", devDebug, MENUID_DEV_DEBUG }, | ||
| 7360 | { "&Timestamp Log", devTimestmp, MENUID_DEV_TIMESTAMP }, | ||
| 7361 | #if DEVLEVEL > 1 | ||
| 7362 | {}, | ||
| 7363 | { "Set &Cheat", setCheat, MENUID_DEV_SETCHEAT }, | ||
| 7364 | #endif //DEVLEVEL > 1 | ||
| 7365 | }; | ||
| 7366 | int32_t devLogging() | ||
| 7367 | { | ||
| 7368 | dev_logging = !dev_logging; | ||
| 7369 | dev_menu.select_uid(MENUID_DEV_LOGGING, dev_logging); | ||
| 7370 | return D_O_K; | ||
| 7371 | } | ||
| 7372 | // int32_t devDebug() | ||
| 7373 | // { | ||
| 7374 | // dev_debug = !dev_debug; | ||
| 7375 | // dev_menu.select_uid(MENUID_DEV_DEBUG, dev_debug); | ||
| 7376 | // dev_menu[dv_dbg].flags = dev_debug ? D_SELECTED : 0; | ||
| 7377 | // return D_O_K; | ||
| 7378 | // } | ||
| 7379 | int32_t devTimestmp() | ||
| 7380 | { | ||
| 7381 | dev_timestmp = !dev_timestmp; | ||
| 7382 | dev_menu.select_uid(MENUID_DEV_TIMESTAMP, dev_timestmp); | ||
| 7383 | return D_O_K; | ||
| 7384 | } | ||
| 7385 | #if DEVLEVEL > 1 | ||
| 7386 | int32_t setCheat() | ||
| 7387 | { | ||
| 7388 | cheat = (vbound(getnumber("Cheat Level",cheat), 0, 4)); | ||
| 7389 | return D_O_K; | ||
| 7390 | } | ||
| 7391 | #endif //DEVLEVEL > 1 | ||
| 7392 | #endif //DEVLEVEL > 0 | ||
| 7393 | |||
| 7394 | enum | ||
| 7395 | { | ||
| 7396 | MENUID_PLAYER_CHEAT, | ||
| 7397 | }; | ||
| 7398 |
1/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
356 | TopMenu the_player_menu |
| 7399 | 2136 | { | |
| 7400 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "&Game", &game_menu }, |
| 7401 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "&Settings", &settings_menu }, |
| 7402 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "&Cheat", &cheat_menu, MENUID_PLAYER_CHEAT, true }, |
| 7403 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "&Replay", &replay_menu }, |
| 7404 |
2/4✓ Branch 0 taken 356 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 356 times.
✗ Branch 3 not taken.
|
356 | { "&ZC", &misc_menu }, |
| 7405 | #if DEVLEVEL > 0 | ||
| 7406 | { "&Dev", &dev_menu }, | ||
| 7407 | #endif | ||
| 7408 | }; | ||
| 7409 | |||
| 7410 | ✗ | int32_t onPauseInBackground() | |
| 7411 | { | ||
| 7412 | ✗ | if(jwin_alert3( | |
| 7413 | "Toggle Pause In Background", | ||
| 7414 | "This action will change whether ZC Player pauses when the window loses focus.", | ||
| 7415 | "", | ||
| 7416 | "Proceed?", | ||
| 7417 | "&Yes", | ||
| 7418 | "&No", | ||
| 7419 | NULL, | ||
| 7420 | 'y', | ||
| 7421 | 'n', | ||
| 7422 | 0, | ||
| 7423 | ✗ | get_zc_font(font_lfont)) == 1) | |
| 7424 | { | ||
| 7425 | ✗ | pause_in_background = pause_in_background ? 0 : 1; | |
| 7426 | ✗ | zc_set_config("zeldadx","pause_in_background", pause_in_background); | |
| 7427 | ✗ | int switch_type = pause_in_background ? SWITCH_PAUSE : SWITCH_BACKGROUND; | |
| 7428 | ✗ | set_display_switch_mode(fullscreen?SWITCH_BACKAMNESIA:switch_type); | |
| 7429 | ✗ | set_display_switch_callback(SWITCH_OUT, switch_out_callback); | |
| 7430 | ✗ | set_display_switch_callback(SWITCH_IN, switch_in_callback); | |
| 7431 | ✗ | } | |
| 7432 | ✗ | options_menu.select_uid(MENUID_OPTIONS_PAUSE_BG, pause_in_background); | |
| 7433 | ✗ | return D_O_K; | |
| 7434 | } | ||
| 7435 | |||
| 7436 | ✗ | int32_t onKeyboardEntry() | |
| 7437 | { | ||
| 7438 | ✗ | NameEntryMode=0; | |
| 7439 | ✗ | zc_set_config(cfg_sect,"name_entry_mode",NameEntryMode); | |
| 7440 | ✗ | return D_O_K; | |
| 7441 | } | ||
| 7442 | |||
| 7443 | ✗ | int32_t onLetterGridEntry() | |
| 7444 | { | ||
| 7445 | ✗ | NameEntryMode=1; | |
| 7446 | ✗ | zc_set_config(cfg_sect,"name_entry_mode",NameEntryMode); | |
| 7447 | ✗ | return D_O_K; | |
| 7448 | } | ||
| 7449 | |||
| 7450 | ✗ | int32_t onExtLetterGridEntry() | |
| 7451 | { | ||
| 7452 | ✗ | NameEntryMode=2; | |
| 7453 | ✗ | zc_set_config(cfg_sect,"name_entry_mode",NameEntryMode); | |
| 7454 | ✗ | return D_O_K; | |
| 7455 | } | ||
| 7456 | |||
| 7457 | static BITMAP* oldscreen; | ||
| 7458 | ✗ | int32_t onFullscreenMenu() | |
| 7459 | { | ||
| 7460 | PALETTE oldpal; | ||
| 7461 | ✗ | get_palette(oldpal); | |
| 7462 | |||
| 7463 | ✗ | fullscreen = !fullscreen; | |
| 7464 | ✗ | all_toggle_fullscreen(fullscreen); | |
| 7465 | ✗ | zc_set_config("zeldadx","fullscreen",fullscreen); | |
| 7466 | |||
| 7467 | ✗ | zc_set_palette(oldpal); | |
| 7468 | ✗ | gui_mouse_focus=0; | |
| 7469 | extern int32_t switch_type; | ||
| 7470 | ✗ | switch_type = pause_in_background ? SWITCH_PAUSE : SWITCH_BACKGROUND; | |
| 7471 | ✗ | set_display_switch_mode(fullscreen?SWITCH_BACKAMNESIA:switch_type); | |
| 7472 | ✗ | set_display_switch_callback(SWITCH_OUT, switch_out_callback); | |
| 7473 | ✗ | set_display_switch_callback(SWITCH_IN, switch_in_callback); | |
| 7474 | ✗ | misc_menu.select_uid(MENUID_MISC_FULLSCREEN, isFullScreen()); | |
| 7475 | ✗ | misc_menu.select_uid(MENUID_MISC_VIDMODE, isFullScreen()); | |
| 7476 | |||
| 7477 | ✗ | return D_O_K; | |
| 7478 | } | ||
| 7479 | |||
| 7480 | 266 | void fix_menu() | |
| 7481 | { | ||
| 7482 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 266 times.
|
266 | if(!debug_enabled) |
| 7483 | 266 | settings_menu.chop_index = 13; | |
| 7484 | 266 | } | |
| 7485 | |||
| 7486 | ✗ | int32_t onSetSnapshotFormat(SnapshotType format) | |
| 7487 | { | ||
| 7488 | ✗ | SnapshotFormat = format; | |
| 7489 | ✗ | zc_set_config("zeldadx", "snapshot_format", format); | |
| 7490 | ✗ | snapshot_format_menu.select_only_index(format); | |
| 7491 | ✗ | return D_O_K; | |
| 7492 | } | ||
| 7493 | |||
| 7494 | |||
| 7495 | ✗ | void color_layer(RGB *src,RGB *dest,char r,char g,char b,char pos,int32_t from,int32_t to) | |
| 7496 | { | ||
| 7497 | PALETTE tmp; | ||
| 7498 | |||
| 7499 | ✗ | for(int32_t i=0; i<256; i++) | |
| 7500 | { | ||
| 7501 | ✗ | tmp[i].r=r; | |
| 7502 | ✗ | tmp[i].g=g; | |
| 7503 | ✗ | tmp[i].b=b; | |
| 7504 | ✗ | } | |
| 7505 | |||
| 7506 | ✗ | fade_interpolate(src,tmp,dest,pos,from,to); | |
| 7507 | ✗ | } | |
| 7508 | |||
| 7509 | 88 | void system_pal(bool force) | |
| 7510 | { | ||
| 7511 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 88 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
88 | if(is_sys_pal && !force) return; |
| 7512 | 88 | is_sys_pal = true; | |
| 7513 | 88 | load_colorset(gui_colorset, syspal, jwin_a5_colors); | |
| 7514 | 88 | hw_palette = &syspal; | |
| 7515 | 88 | update_hw_pal = true; | |
| 7516 | 88 | } | |
| 7517 | |||
| 7518 | static uint32_t entered_sys_pal = 0; | ||
| 7519 | 88 | void enter_sys_pal() | |
| 7520 | { | ||
| 7521 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 88 times.
|
88 | if(is_sys_pal) |
| 7522 | { | ||
| 7523 | ✗ | if(entered_sys_pal) | |
| 7524 | ✗ | ++entered_sys_pal; | |
| 7525 | ✗ | return; | |
| 7526 | } | ||
| 7527 | 88 | sys_mouse(); | |
| 7528 | 88 | system_pal(true); | |
| 7529 | 88 | ++entered_sys_pal; | |
| 7530 | 88 | } | |
| 7531 | 88 | void exit_sys_pal() | |
| 7532 | { | ||
| 7533 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 88 times.
|
88 | if(entered_sys_pal) |
| 7534 | { | ||
| 7535 |
1/2✓ Branch 0 taken 88 times.
✗ Branch 1 not taken.
|
88 | if(!--entered_sys_pal) |
| 7536 | { | ||
| 7537 | 88 | game_pal(); | |
| 7538 | 88 | game_mouse(); | |
| 7539 | 88 | } | |
| 7540 | 88 | } | |
| 7541 | 88 | } | |
| 7542 | |||
| 7543 | ✗ | void switch_out_callback() | |
| 7544 | { | ||
| 7545 | ✗ | if (pause_in_background && !MenuOpen) | |
| 7546 | { | ||
| 7547 | ✗ | System(); | |
| 7548 | ✗ | } | |
| 7549 | ✗ | } | |
| 7550 | |||
| 7551 | ✗ | void switch_in_callback() | |
| 7552 | { | ||
| 7553 | ✗ | } | |
| 7554 | |||
| 7555 | 1138 | void game_pal() | |
| 7556 | { | ||
| 7557 | 1138 | is_sys_pal = false; | |
| 7558 | 1138 | entered_sys_pal = 0; | |
| 7559 | 1138 | hw_palette = &RAMpal; | |
| 7560 | 1138 | update_hw_pal = true; | |
| 7561 | 1138 | } | |
| 7562 | |||
| 7563 | static char bar_str[] = ""; | ||
| 7564 | |||
| 7565 | 61 | void music_pause() | |
| 7566 | { | ||
| 7567 | //al_pause_duh(tmplayer); | ||
| 7568 | 61 | zcmusic_pause(zcmusic, ZCM_PAUSE); | |
| 7569 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 61 times.
|
61 | if(zcmixer->oldtrack) |
| 7570 | ✗ | zcmusic_pause(zcmixer->oldtrack, ZCM_PAUSE); | |
| 7571 | 61 | zc_midi_pause(); | |
| 7572 | 61 | } | |
| 7573 | |||
| 7574 | ✗ | void music_resume() | |
| 7575 | { | ||
| 7576 | //al_resume_duh(tmplayer); | ||
| 7577 | ✗ | zcmusic_pause(zcmusic, ZCM_RESUME); | |
| 7578 | ✗ | if (zcmixer->oldtrack) | |
| 7579 | ✗ | zcmusic_pause(zcmixer->oldtrack, ZCM_RESUME); | |
| 7580 | ✗ | zc_midi_resume(); | |
| 7581 | ✗ | } | |
| 7582 | |||
| 7583 | 7879 | void music_stop() | |
| 7584 | { | ||
| 7585 | //al_stop_duh(tmplayer); | ||
| 7586 | //unload_duh(tmusic); | ||
| 7587 | //tmusic=NULL; | ||
| 7588 | //tmplayer=NULL; | ||
| 7589 | 7879 | zcmusic_stop(zcmusic); | |
| 7590 | 7879 | zcmusic_unload_file(zcmusic); | |
| 7591 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7879 times.
|
7879 | if (zcmixer->oldtrack) |
| 7592 | { | ||
| 7593 | ✗ | zcmusic_stop(zcmixer->oldtrack); | |
| 7594 | ✗ | zcmusic_unload_file(zcmixer->oldtrack); | |
| 7595 | ✗ | } | |
| 7596 | 7879 | zcmixer->newtrack = NULL; | |
| 7597 | 7879 | zc_stop_midi(); | |
| 7598 | 7879 | currmidi=-1; | |
| 7599 | 7879 | } | |
| 7600 | |||
| 7601 | bool reload_fonts = false; | ||
| 7602 | ✗ | void System() | |
| 7603 | { | ||
| 7604 | ✗ | mouse_down = gui_mouse_b(); | |
| 7605 | ✗ | music_pause(); | |
| 7606 | ✗ | pause_all_sfx(); | |
| 7607 | ✗ | MenuOpen = true; | |
| 7608 | ✗ | enter_sys_pal(); | |
| 7609 | // FONT *oldfont=font; | ||
| 7610 | // font=tfont; | ||
| 7611 | |||
| 7612 | ✗ | misc_menu.select_uid(MENUID_MISC_FULLSCREEN, isFullScreen()); | |
| 7613 | ✗ | misc_menu.disable_uid(MENUID_MISC_VIDMODE, isFullScreen()); | |
| 7614 | |||
| 7615 | #if DEVLEVEL > 1 | ||
| 7616 | dev_menu.disable_uid(MENUID_DEV_SETCHEAT, !Playing); | ||
| 7617 | #endif | ||
| 7618 | ✗ | game_menu.disable_uid(MENUID_GAME_LOADQUEST, getsaveslot() < 0); | |
| 7619 | ✗ | game_menu.disable_uid(MENUID_GAME_ENDGAME, !Playing); | |
| 7620 | ✗ | misc_menu.disable_uid(MENUID_MISC_QUEST_INFO, !Playing); | |
| 7621 | ✗ | misc_menu.disable_uid(MENUID_MISC_QUEST_DIR, Playing); | |
| 7622 | ✗ | clear_keybuf(); | |
| 7623 | |||
| 7624 | ✗ | clear_bitmap(menu_bmp); | |
| 7625 | ✗ | oldscreen = screen; | |
| 7626 | ✗ | screen = menu_bmp; | |
| 7627 | |||
| 7628 | ✗ | the_player_menu.reset_state(); | |
| 7629 | ✗ | the_player_menu.position(0, 0); | |
| 7630 | |||
| 7631 | ✗ | bool running = true; | |
| 7632 | ✗ | bool esc = key[KEY_ESC] || cMbtn(); | |
| 7633 | ✗ | bool autopop = esc; | |
| 7634 | ✗ | do | |
| 7635 | { | ||
| 7636 | ✗ | if(reload_fonts) | |
| 7637 | { | ||
| 7638 | ✗ | init_custom_fonts(); | |
| 7639 | ✗ | clear_bitmap(menu_bmp); | |
| 7640 | ✗ | broadcast_dialog_message(MSG_DRAW, 0); | |
| 7641 | ✗ | reload_fonts = false; | |
| 7642 | ✗ | } | |
| 7643 | ✗ | if(handle_close_btn_quit()) | |
| 7644 | ✗ | break; | |
| 7645 | |||
| 7646 | //update submenus | ||
| 7647 | { | ||
| 7648 | ✗ | settings_menu.disable_uid(MENUID_SETTINGS_CONTROLS, replay_is_replaying()); | |
| 7649 | ✗ | settings_menu.select_uid(MENUID_SETTINGS_CAPFPS, Throttlefps); | |
| 7650 | ✗ | settings_menu.select_uid(MENUID_SETTINGS_SHOWFPS, ShowFPS); | |
| 7651 | ✗ | settings_menu.select_uid(MENUID_SETTINGS_SHOWTIME, ShowGameTime); | |
| 7652 | ✗ | settings_menu.select_uid(MENUID_SETTINGS_CLICK_FREEZE, ClickToFreeze); | |
| 7653 | ✗ | settings_menu.select_uid(MENUID_SETTINGS_TRANSLAYERS, TransLayers); | |
| 7654 | ✗ | settings_menu.select_uid(MENUID_SETTINGS_NESQUIT, NESquit); | |
| 7655 | ✗ | settings_menu.select_uid(MENUID_SETTINGS_VOLKEYS, volkeys); | |
| 7656 | |||
| 7657 | ✗ | window_menu.select_uid(MENUID_WINDOW_LOCK_ASPECT, DragAspect); | |
| 7658 | ✗ | window_menu.select_uid(MENUID_WINDOW_LOCK_INTSCALE, scaleForceInteger); | |
| 7659 | ✗ | window_menu.select_uid(MENUID_WINDOW_SAVE_SIZE, SaveDragResize); | |
| 7660 | ✗ | window_menu.select_uid(MENUID_WINDOW_SAVE_POS, SaveWinPos); | |
| 7661 | ✗ | window_menu.select_uid(MENUID_WINDOW_STRETCH, stretchGame); | |
| 7662 | |||
| 7663 | ✗ | options_menu.select_uid(MENUID_OPTIONS_EPILEPSYPROT, epilepsyFlashReduction); | |
| 7664 | ✗ | options_menu.select_uid(MENUID_OPTIONS_PAUSE_BG, pause_in_background); | |
| 7665 | |||
| 7666 | ✗ | name_entry_mode_menu.select_only_index(NameEntryMode); | |
| 7667 | |||
| 7668 | ✗ | misc_menu.select_uid(MENUID_MISC_CONSOLE, console_enabled); | |
| 7669 | ✗ | misc_menu.select_uid(MENUID_MISC_CLEAR_CONSOLE_ON_LOAD, clearConsoleOnLoad); | |
| 7670 | |||
| 7671 | ✗ | bool nocheat = (replay_is_replaying() || !Playing | |
| 7672 | ✗ | || (!maxcheat && !zcheats.flags && !get_debug() && DEVLEVEL < 2 && !zqtesting_mode && !devpwd())); | |
| 7673 | ✗ | the_player_menu.disable_uid(MENUID_PLAYER_CHEAT, nocheat); | |
| 7674 | ✗ | refill_menu.disable_uid(MENUID_REFILL_ARROWS, !get_qr(qr_TRUEARROWS)); | |
| 7675 | ✗ | cheat_menu.chop_index.reset(); | |
| 7676 | ✗ | if(cheat < 4) | |
| 7677 | ✗ | cheat_menu.chop_index = cheat_menu.ind_at(MENUID_CHEAT_CHOP_L1+cheat); | |
| 7678 | ✗ | cheat_menu.select_uid(MENUID_CHEAT_INVULN, getClock()); | |
| 7679 | ✗ | cheat_menu.select_uid(MENUID_CHEAT_NOCLIP, toogam); | |
| 7680 | ✗ | cheat_menu.select_uid(MENUID_CHEAT_IGNORESV, ignoreSideview); | |
| 7681 | ✗ | cheat_menu.select_uid(MENUID_CHEAT_GOFAST, gofast); | |
| 7682 | |||
| 7683 | ✗ | show_menu.select_uid(MENUID_SHOW_L0, show_layer_0); | |
| 7684 | ✗ | show_menu.select_uid(MENUID_SHOW_L1, show_layer_1); | |
| 7685 | ✗ | show_menu.select_uid(MENUID_SHOW_L2, show_layer_2); | |
| 7686 | ✗ | show_menu.select_uid(MENUID_SHOW_L3, show_layer_3); | |
| 7687 | ✗ | show_menu.select_uid(MENUID_SHOW_L4, show_layer_4); | |
| 7688 | ✗ | show_menu.select_uid(MENUID_SHOW_L5, show_layer_5); | |
| 7689 | ✗ | show_menu.select_uid(MENUID_SHOW_L6, show_layer_6); | |
| 7690 | ✗ | show_menu.select_uid(MENUID_SHOW_OVER, show_layer_over); | |
| 7691 | ✗ | show_menu.select_uid(MENUID_SHOW_PUSH, show_layer_push); | |
| 7692 | ✗ | show_menu.select_uid(MENUID_SHOW_SPR, show_sprites); | |
| 7693 | ✗ | show_menu.select_uid(MENUID_SHOW_FFC, show_ffcs); | |
| 7694 | ✗ | show_menu.select_uid(MENUID_SHOW_SOLIDITY, show_walkflags); | |
| 7695 | ✗ | show_menu.select_uid(MENUID_SHOW_SCRIPTNAME, show_ff_scripts); | |
| 7696 | ✗ | show_menu.select_uid(MENUID_SHOW_HITBOX, show_hitboxes); | |
| 7697 | ✗ | show_menu.select_uid(MENUID_SHOW_EFFECT, show_effectflags); | |
| 7698 | |||
| 7699 | ✗ | settings_menu.select_uid(MENUID_SETTINGS_HEARTBEEP, heart_beep); | |
| 7700 | ✗ | settings_menu.select_uid(MENUID_SETTINGS_SAVEINDICATOR, use_save_indicator); | |
| 7701 | |||
| 7702 | ✗ | replay_menu.by_uid(MENUID_REPLAY_STOP)->text = fmt::format("Stop {}", | |
| 7703 | ✗ | replay_get_mode() == ReplayMode::Record ? "recording" : "replaying"); | |
| 7704 | |||
| 7705 | ✗ | replay_menu.select_uid(MENUID_REPLAY_RECORDNEW, zc_get_config("zeldadx", "replay_new_saves", false)); | |
| 7706 | #ifdef HAS_CURL | ||
| 7707 | ✗ | replay_menu.select_uid(MENUID_REPLAY_AUTOUPLOAD, replay_upload_auto_enabled()); | |
| 7708 | #endif | ||
| 7709 | ✗ | replay_menu.disable_uid(MENUID_REPLAY_STOP, !replay_is_active()); | |
| 7710 | ✗ | replay_menu.disable_uid(MENUID_REPLAY_SAVE, replay_get_mode() != ReplayMode::Record); | |
| 7711 | ✗ | replay_menu.select_uid(MENUID_REPLAY_SNAP_ALL, replay_is_snapshot_all_frames()); | |
| 7712 | |||
| 7713 | ✗ | snapshot_format_menu.select_only_index(SnapshotFormat); | |
| 7714 | } | ||
| 7715 | |||
| 7716 | ✗ | if(debug_enabled) | |
| 7717 | ✗ | settings_menu.select_uid(MENUID_SETTINGS_DEBUG, get_debug()); | |
| 7718 | |||
| 7719 | ✗ | if(autopop) | |
| 7720 | ✗ | clear_keybuf(); | |
| 7721 | ✗ | the_player_menu.run(true); | |
| 7722 | ✗ | if(autopop) | |
| 7723 | { | ||
| 7724 | ✗ | the_player_menu.pop_sub(0, &the_player_menu); | |
| 7725 | ✗ | the_player_menu.draw(screen, the_player_menu.hovered_ind()); | |
| 7726 | ✗ | autopop = false; | |
| 7727 | ✗ | update_hw_screen(); | |
| 7728 | ✗ | } | |
| 7729 | |||
| 7730 | ✗ | update_hw_screen(); | |
| 7731 | |||
| 7732 | ✗ | auto mb = gui_mouse_b(); | |
| 7733 | ✗ | if(XOR(mb, mouse_down)) | |
| 7734 | { | ||
| 7735 | ✗ | if(!the_player_menu.has_mouse()) | |
| 7736 | ✗ | if(mb) | |
| 7737 | ✗ | break; | |
| 7738 | ✗ | mouse_down = mb; | |
| 7739 | ✗ | } | |
| 7740 | |||
| 7741 | ✗ | if(input_idle(true) > after_time()) | |
| 7742 | // run Screeen Saver | ||
| 7743 | { | ||
| 7744 | // Screen saver enabled for now. | ||
| 7745 | ✗ | clear_keybuf(); | |
| 7746 | ✗ | Matrix(ss_speed, ss_density, 0); | |
| 7747 | ✗ | system_pal(true); | |
| 7748 | ✗ | sys_mouse(); | |
| 7749 | ✗ | } | |
| 7750 | |||
| 7751 | ✗ | poll_keyboard(); | |
| 7752 | ✗ | if(esc) | |
| 7753 | { | ||
| 7754 | ✗ | if(!key[KEY_ESC]) | |
| 7755 | ✗ | esc = false; | |
| 7756 | ✗ | } | |
| 7757 | |||
| 7758 | ✗ | if(keypressed() && !CHECK_ALT) //System hotkeys | |
| 7759 | { | ||
| 7760 | ✗ | auto c = peekkey(); | |
| 7761 | ✗ | bool eatkey = true; | |
| 7762 | ✗ | switch(c>>8) | |
| 7763 | { | ||
| 7764 | //Spare keys used by the menu | ||
| 7765 | case KEY_UP: | ||
| 7766 | case KEY_DOWN: | ||
| 7767 | case KEY_LEFT: | ||
| 7768 | case KEY_RIGHT: | ||
| 7769 | ✗ | eatkey = false; | |
| 7770 | ✗ | break; | |
| 7771 | case KEY_F1: | ||
| 7772 | ✗ | onThrottleFPS(); | |
| 7773 | ✗ | break; | |
| 7774 | case KEY_F2: | ||
| 7775 | ✗ | onShowFPS(); | |
| 7776 | ✗ | break; | |
| 7777 | case KEY_F6: | ||
| 7778 | ✗ | onTryQuitMenu(); | |
| 7779 | ✗ | break; | |
| 7780 | #ifndef ALLEGRO_MACOSX | ||
| 7781 | case KEY_F9: | ||
| 7782 | ✗ | onReset(); | |
| 7783 | ✗ | break; | |
| 7784 | case KEY_F10: | ||
| 7785 | ✗ | onExit(); | |
| 7786 | ✗ | break; | |
| 7787 | #else | ||
| 7788 | case KEY_F7: | ||
| 7789 | onReset(); | ||
| 7790 | break; | ||
| 7791 | case KEY_F8: | ||
| 7792 | onExit(); | ||
| 7793 | break; | ||
| 7794 | #endif | ||
| 7795 | case KEY_F12: | ||
| 7796 | ✗ | onSnapshot(); | |
| 7797 | ✗ | break; | |
| 7798 | case KEY_TAB: | ||
| 7799 | ✗ | onDebug(); | |
| 7800 | ✗ | break; | |
| 7801 | case KEY_ESC: | ||
| 7802 | ✗ | if(!esc) | |
| 7803 | ✗ | running = false; | |
| 7804 | ✗ | break; | |
| 7805 | } | ||
| 7806 | ✗ | if(eatkey) | |
| 7807 | ✗ | readkey(); | |
| 7808 | ✗ | } | |
| 7809 | ✗ | if(Quit || (GameFlags & GAMEFLAG_TRYQUIT)) | |
| 7810 | ✗ | break; | |
| 7811 | ✗ | } | |
| 7812 | ✗ | while(running); | |
| 7813 | |||
| 7814 | ✗ | screen = oldscreen; | |
| 7815 | |||
| 7816 | ✗ | mouse_down=gui_mouse_b(); | |
| 7817 | ✗ | MenuOpen = false; | |
| 7818 | ✗ | if(Quit) | |
| 7819 | { | ||
| 7820 | ✗ | kill_sfx(); | |
| 7821 | ✗ | music_stop(); | |
| 7822 | ✗ | update_hw_screen(); | |
| 7823 | ✗ | } | |
| 7824 | else | ||
| 7825 | { | ||
| 7826 | ✗ | music_resume(); | |
| 7827 | ✗ | resume_all_sfx(); | |
| 7828 | |||
| 7829 | ✗ | if(rc) | |
| 7830 | ✗ | ringcolor(false); | |
| 7831 | } | ||
| 7832 | ✗ | exit_sys_pal(); | |
| 7833 | |||
| 7834 | ✗ | eat_buttons(); | |
| 7835 | |||
| 7836 | ✗ | rc=false; | |
| 7837 | ✗ | clear_keybuf(); | |
| 7838 | |||
| 7839 | ✗ | zc_init_apply_cheat_delta(); | |
| 7840 | ✗ | } | |
| 7841 | |||
| 7842 | 266 | void fix_dialogs() | |
| 7843 | { | ||
| 7844 | 266 | jwin_center_dialog(about_dlg); | |
| 7845 | 266 | jwin_center_dialog(gamepad_dlg); | |
| 7846 | 266 | jwin_center_dialog(credits_dlg); | |
| 7847 | 266 | jwin_center_dialog(gamemode_dlg); | |
| 7848 | 266 | jwin_center_dialog(getnum_dlg); | |
| 7849 | 266 | jwin_center_dialog(goto_dlg); | |
| 7850 | 266 | jwin_center_dialog(keyboard_control_dlg); | |
| 7851 | 266 | jwin_center_dialog(midi_dlg); | |
| 7852 | 266 | jwin_center_dialog(quest_dlg); | |
| 7853 | 266 | jwin_center_dialog(scrsaver_dlg); | |
| 7854 | 266 | jwin_center_dialog(sound_dlg); | |
| 7855 | 266 | jwin_center_dialog(triforce_dlg); | |
| 7856 | 266 | } | |
| 7857 | |||
| 7858 | 4332 | INLINE int32_t mixvol(int32_t v1,int32_t v2) | |
| 7859 | { | ||
| 7860 |
3/4✓ Branch 0 taken 4332 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4285 times.
✓ Branch 3 taken 47 times.
|
4332 | return (zc_min(v1,255)*zc_min(v2,255)) >> 8; |
| 7861 | } | ||
| 7862 | |||
| 7863 | 290 | int32_t get_emusic_volume() | |
| 7864 | { | ||
| 7865 | 290 | int32_t temp_volume = emusic_volume; | |
| 7866 |
2/4✓ Branch 0 taken 290 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 290 times.
✗ Branch 3 not taken.
|
290 | if (GameLoaded && !get_qr(qr_OLD_SCRIPT_VOLUME)) |
| 7867 | ✗ | temp_volume = (emusic_volume * FFCore.usr_music_volume) / 10000 / 100; | |
| 7868 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 290 times.
|
290 | if (!zcmusic) |
| 7869 | 290 | return temp_volume; | |
| 7870 | ✗ | return (temp_volume * zcmusic->fadevolume) / 10000; | |
| 7871 | 290 | } | |
| 7872 | |||
| 7873 | ✗ | int32_t get_zcmusicpos() | |
| 7874 | { | ||
| 7875 | ✗ | int32_t debugtracething = zcmusic_get_curpos(zcmusic); | |
| 7876 | ✗ | return debugtracething; | |
| 7877 | return 0; | ||
| 7878 | } | ||
| 7879 | |||
| 7880 | ✗ | void set_zcmusicpos(int32_t position) | |
| 7881 | { | ||
| 7882 | ✗ | zcmusic_set_curpos(zcmusic, position); | |
| 7883 | ✗ | } | |
| 7884 | |||
| 7885 | ✗ | void set_zcmusicspeed(int32_t speed) | |
| 7886 | { | ||
| 7887 | ✗ | zcmusic_set_speed(zcmusic, speed); | |
| 7888 | ✗ | } | |
| 7889 | |||
| 7890 | ✗ | int32_t get_zcmusiclen() | |
| 7891 | { | ||
| 7892 | ✗ | return zcmusic_get_length(zcmusic); | |
| 7893 | } | ||
| 7894 | |||
| 7895 | 3 | void set_zcmusicloop(double start, double end) | |
| 7896 | { | ||
| 7897 | 3 | zcmusic_set_loop(zcmusic, start, end); | |
| 7898 | 3 | } | |
| 7899 | |||
| 7900 | 64181 | void jukebox(int32_t index,int32_t loop) | |
| 7901 | { | ||
| 7902 |
2/2✓ Branch 0 taken 64156 times.
✓ Branch 1 taken 25 times.
|
64181 | if (is_headless()) |
| 7903 | 64156 | return; | |
| 7904 | |||
| 7905 | 25 | music_stop(); | |
| 7906 | |||
| 7907 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 25 times.
|
25 | if(index<0) index=MAXMIDIS-1; |
| 7908 | |||
| 7909 |
1/2✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
|
25 | if(index>=MAXMIDIS) index=0; |
| 7910 | |||
| 7911 | 25 | music_stop(); | |
| 7912 | |||
| 7913 | // Allegro's DIGMID driver (the one normally used on on Linux) gets | ||
| 7914 | // stuck notes when a song stops. This fixes it. | ||
| 7915 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 25 times.
|
25 | if(strcmp(midi_driver->name, "DIGMID")==0) |
| 7916 | ✗ | zc_set_volume(0, 0); | |
| 7917 | |||
| 7918 | 25 | zc_set_volume(-1, mixvol(tunes[index].volume, midi_volume >>1)); | |
| 7919 | 25 | zc_play_midi((MIDI*)tunes[index].data,loop); | |
| 7920 | |||
| 7921 |
1/2✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
|
25 | if(tunes[index].start>0) |
| 7922 | ✗ | zc_midi_seek(tunes[index].start); | |
| 7923 | |||
| 7924 | 25 | midi_loop_start = tunes[index].loop_start; | |
| 7925 | 25 | midi_loop_end = tunes[index].loop_end; | |
| 7926 | |||
| 7927 | 25 | currmidi=index; | |
| 7928 | 25 | master_volume(digi_volume, midi_volume); | |
| 7929 | //midi_paused=false; | ||
| 7930 | 64181 | } | |
| 7931 | |||
| 7932 | 64192 | void jukebox(int32_t index) | |
| 7933 | { | ||
| 7934 |
1/2✓ Branch 0 taken 64192 times.
✗ Branch 1 not taken.
|
64192 | if(index<0) index=MAXMIDIS-1; |
| 7935 | |||
| 7936 |
1/2✓ Branch 0 taken 64192 times.
✗ Branch 1 not taken.
|
64192 | if(index>=MAXMIDIS) index=0; |
| 7937 | |||
| 7938 | // do nothing if it's already playing | ||
| 7939 |
3/4✓ Branch 0 taken 11 times.
✓ Branch 1 taken 64181 times.
✓ Branch 2 taken 11 times.
✗ Branch 3 not taken.
|
64192 | if(index==currmidi && midi_pos>=0) |
| 7940 | { | ||
| 7941 | 11 | return; | |
| 7942 | } | ||
| 7943 | |||
| 7944 | 64181 | jukebox(index,tunes[index].loop); | |
| 7945 | 64192 | } | |
| 7946 | |||
| 7947 | 159 | void play_DmapMusic() | |
| 7948 | { | ||
| 7949 |
2/2✓ Branch 0 taken 100 times.
✓ Branch 1 taken 59 times.
|
159 | if (is_headless()) |
| 7950 | 100 | return; | |
| 7951 | |||
| 7952 | static char tfile[2048]; | ||
| 7953 | static int32_t ttrack=0; | ||
| 7954 | 59 | bool domidi=false; | |
| 7955 | |||
| 7956 | 59 | int32_t fadeoutframes = 0; | |
| 7957 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | if (zcmusic != NULL) |
| 7958 | ✗ | fadeoutframes = zcmusic->fadeoutframes; | |
| 7959 | |||
| 7960 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 59 times.
|
59 | if(DMaps[currdmap].tmusic[0]!=0) |
| 7961 | { | ||
| 7962 | ✗ | if(zcmusic==NULL || | |
| 7963 | ✗ | strcmp(zcmusic->filename,DMaps[currdmap].tmusic)!=0 || | |
| 7964 | ✗ | (zcmusic->type==ZCMF_GME && zcmusic->track != DMaps[currdmap].tmusictrack)) | |
| 7965 | { | ||
| 7966 | ✗ | if (DMaps[currdmap].tmusic_xfade_in > 0 || fadeoutframes > 0) | |
| 7967 | { | ||
| 7968 | ✗ | if (play_enh_music_crossfade(DMaps[currdmap].tmusic, qstpath, DMaps[currdmap].tmusictrack, get_emusic_volume(), DMaps[currdmap].tmusic_xfade_in, fadeoutframes)) | |
| 7969 | { | ||
| 7970 | ✗ | if (zcmusic != NULL) | |
| 7971 | { | ||
| 7972 | ✗ | zcmusic->fadeoutframes = DMaps[currdmap].tmusic_xfade_out; | |
| 7973 | ✗ | zcmusic_set_loop(zcmusic, double(DMaps[currdmap].tmusic_loop_start / 10000.0), double(DMaps[currdmap].tmusic_loop_end / 10000.0)); | |
| 7974 | ✗ | } | |
| 7975 | ✗ | } | |
| 7976 | ✗ | } | |
| 7977 | else | ||
| 7978 | { | ||
| 7979 | ✗ | if (zcmusic != NULL) | |
| 7980 | { | ||
| 7981 | ✗ | zcmusic_stop(zcmusic); | |
| 7982 | ✗ | zcmusic_unload_file(zcmusic); | |
| 7983 | ✗ | zcmusic = NULL; | |
| 7984 | ✗ | zcmixer->newtrack = NULL; | |
| 7985 | ✗ | } | |
| 7986 | |||
| 7987 | ✗ | zcmusic = zcmusic_load_for_quest(DMaps[currdmap].tmusic, qstpath); | |
| 7988 | ✗ | zcmixer->newtrack = zcmusic; | |
| 7989 | |||
| 7990 | ✗ | if (zcmusic != NULL) | |
| 7991 | { | ||
| 7992 | ✗ | zc_stop_midi(); | |
| 7993 | ✗ | strcpy(tfile, DMaps[currdmap].tmusic); | |
| 7994 | ✗ | zcmusic_play(zcmusic, emusic_volume); | |
| 7995 | ✗ | int32_t temptracks = 0; | |
| 7996 | ✗ | temptracks = zcmusic_get_tracks(zcmusic); | |
| 7997 | ✗ | temptracks = (temptracks < 2) ? 1 : temptracks; | |
| 7998 | ✗ | ttrack = vbound(DMaps[currdmap].tmusictrack, 0, temptracks - 1); | |
| 7999 | ✗ | zcmusic_change_track(zcmusic, ttrack); | |
| 8000 | ✗ | zcmusic_set_loop(zcmusic, double(DMaps[currdmap].tmusic_loop_start / 10000.0), double(DMaps[currdmap].tmusic_loop_end / 10000.0)); | |
| 8001 | ✗ | } | |
| 8002 | else | ||
| 8003 | { | ||
| 8004 | ✗ | tfile[0] = 0; | |
| 8005 | ✗ | domidi = true; | |
| 8006 | } | ||
| 8007 | } | ||
| 8008 | ✗ | } | |
| 8009 | ✗ | } | |
| 8010 | else | ||
| 8011 | { | ||
| 8012 |
3/8✓ Branch 0 taken 23 times.
✓ Branch 1 taken 36 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 23 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
59 | if (DMaps[currdmap].midi == 0 && fadeoutframes > 0 && zcmusic != NULL && strcmp(zcmusic->filename, DMaps[currdmap].tmusic) != 0) |
| 8013 | { | ||
| 8014 | ✗ | play_enh_music_crossfade(NULL, qstpath, DMaps[currdmap].tmusictrack, get_emusic_volume(), DMaps[currdmap].tmusic_xfade_in, fadeoutframes); | |
| 8015 | ✗ | } | |
| 8016 | else | ||
| 8017 | { | ||
| 8018 | 59 | domidi = true; | |
| 8019 | } | ||
| 8020 | } | ||
| 8021 | |||
| 8022 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 59 times.
|
59 | if(domidi) |
| 8023 | { | ||
| 8024 | 59 | int32_t m=DMaps[currdmap].midi; | |
| 8025 | |||
| 8026 |
2/4✓ Branch 0 taken 23 times.
✓ Branch 1 taken 36 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
59 | switch(m) |
| 8027 | { | ||
| 8028 | case 1: | ||
| 8029 | 36 | jukebox(ZC_MIDI_OVERWORLD); | |
| 8030 | 36 | break; | |
| 8031 | |||
| 8032 | case 2: | ||
| 8033 | ✗ | jukebox(ZC_MIDI_DUNGEON); | |
| 8034 | ✗ | break; | |
| 8035 | |||
| 8036 | case 3: | ||
| 8037 | ✗ | jukebox(ZC_MIDI_LEVEL9); | |
| 8038 | ✗ | break; | |
| 8039 | |||
| 8040 | default: | ||
| 8041 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 23 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
23 | if(m>=4 && m<4+MAXCUSTOMMIDIS) |
| 8042 | ✗ | jukebox(m+MIDIOFFSET_DMAP); | |
| 8043 | else | ||
| 8044 | 23 | music_stop(); | |
| 8045 | 23 | } | |
| 8046 | 59 | } | |
| 8047 | 159 | } | |
| 8048 | |||
| 8049 | 34932 | void playLevelMusic() | |
| 8050 | { | ||
| 8051 |
2/2✓ Branch 0 taken 34873 times.
✓ Branch 1 taken 59 times.
|
34932 | if (is_headless()) |
| 8052 | 34873 | return; | |
| 8053 | |||
| 8054 | 59 | int32_t m=tmpscr->screen_midi; | |
| 8055 | |||
| 8056 |
1/6✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
59 | switch(m) |
| 8057 | { | ||
| 8058 | case -2: | ||
| 8059 | ✗ | music_stop(); | |
| 8060 | ✗ | break; | |
| 8061 | |||
| 8062 | case -1: | ||
| 8063 | 59 | play_DmapMusic(); | |
| 8064 | 59 | break; | |
| 8065 | |||
| 8066 | case 1: | ||
| 8067 | ✗ | jukebox(ZC_MIDI_OVERWORLD); | |
| 8068 | ✗ | break; | |
| 8069 | |||
| 8070 | case 2: | ||
| 8071 | ✗ | jukebox(ZC_MIDI_DUNGEON); | |
| 8072 | ✗ | break; | |
| 8073 | |||
| 8074 | case 3: | ||
| 8075 | ✗ | jukebox(ZC_MIDI_LEVEL9); | |
| 8076 | ✗ | break; | |
| 8077 | |||
| 8078 | default: | ||
| 8079 | ✗ | if(m>=4 && m<4+MAXCUSTOMMIDIS) | |
| 8080 | ✗ | jukebox(m+MIDIOFFSET_MAPSCR); | |
| 8081 | else | ||
| 8082 | ✗ | music_stop(); | |
| 8083 | ✗ | } | |
| 8084 | 34932 | } | |
| 8085 | |||
| 8086 | 4307 | void master_volume(int32_t dv,int32_t mv) | |
| 8087 | { | ||
| 8088 |
7/8✓ Branch 0 taken 2008 times.
✓ Branch 1 taken 2299 times.
✓ Branch 2 taken 1967 times.
✓ Branch 3 taken 332 times.
✓ Branch 4 taken 2299 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1967 times.
✓ Branch 7 taken 332 times.
|
4307 | if(dv>=0) digi_volume=zc_max(zc_min(dv,255),0); |
| 8089 | |||
| 8090 |
7/8✓ Branch 0 taken 2004 times.
✓ Branch 1 taken 2303 times.
✓ Branch 2 taken 2000 times.
✓ Branch 3 taken 303 times.
✓ Branch 4 taken 2303 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2000 times.
✓ Branch 7 taken 303 times.
|
4307 | if(mv>=0) midi_volume=zc_max(zc_min(mv,255),0); |
| 8091 | |||
| 8092 |
5/6✓ Branch 0 taken 25 times.
✓ Branch 1 taken 4282 times.
✓ Branch 2 taken 4307 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 25 times.
✓ Branch 5 taken 4282 times.
|
4307 | int32_t i = zc_min(zc_max(currmidi,0),MAXMIDIS-1); |
| 8093 | 4307 | int32_t temp_vol = midi_volume; | |
| 8094 |
2/2✓ Branch 0 taken 4041 times.
✓ Branch 1 taken 266 times.
|
4307 | if (!get_qr(qr_OLD_SCRIPT_VOLUME)) |
| 8095 | 266 | temp_vol = (midi_volume * FFCore.usr_music_volume) / 10000 / 100; | |
| 8096 | 4307 | zc_set_volume(digi_volume,mixvol(tunes[i].volume, temp_vol)); | |
| 8097 | 4307 | } | |
| 8098 | |||
| 8099 | // array of voices, one for each sfx sample in the data file | ||
| 8100 | // 0+ = voice # | ||
| 8101 | // -1 = voice not allocated | ||
| 8102 | 266 | void Z_init_sound() | |
| 8103 | { | ||
| 8104 |
2/2✓ Branch 0 taken 68096 times.
✓ Branch 1 taken 266 times.
|
68362 | for(int32_t i=0; i<WAV_COUNT; i++) |
| 8105 | 68096 | sfx_voice[i]=-1; | |
| 8106 | |||
| 8107 | 266 | const char* midis[ZC_MIDI_COUNT] = { | |
| 8108 | "assets/dungeon.mid", | ||
| 8109 | "assets/ending.mid", | ||
| 8110 | "assets/gameover.mid", | ||
| 8111 | "assets/level9.mid", | ||
| 8112 | "assets/overworld.mid", | ||
| 8113 | "assets/title.mid", | ||
| 8114 | "assets/triforce.mid", | ||
| 8115 | }; | ||
| 8116 |
2/2✓ Branch 0 taken 1862 times.
✓ Branch 1 taken 266 times.
|
2128 | for(int32_t i=0; i<ZC_MIDI_COUNT; i++) |
| 8117 | { | ||
| 8118 | 1862 | tunes[i].data = load_midi(midis[i]); | |
| 8119 |
1/2✓ Branch 0 taken 1862 times.
✗ Branch 1 not taken.
|
1862 | if (!tunes[i].data) |
| 8120 | ✗ | Z_error_fatal("Missing required file %s\n", midis[i]); | |
| 8121 | 1862 | } | |
| 8122 | |||
| 8123 |
2/2✓ Branch 0 taken 67032 times.
✓ Branch 1 taken 266 times.
|
67298 | for(int32_t j=0; j<MAXCUSTOMMIDIS; j++) |
| 8124 | 67032 | tunes[ZC_MIDI_COUNT+j].data=NULL; | |
| 8125 | |||
| 8126 | 266 | master_volume(digi_volume,midi_volume); | |
| 8127 | 266 | } | |
| 8128 | |||
| 8129 | // returns number of voices currently allocated | ||
| 8130 | ✗ | int32_t sfx_count() | |
| 8131 | { | ||
| 8132 | ✗ | int32_t c=0; | |
| 8133 | |||
| 8134 | ✗ | for(int32_t i=0; i<WAV_COUNT; i++) | |
| 8135 | ✗ | if(sfx_voice[i]!=-1) | |
| 8136 | ✗ | ++c; | |
| 8137 | |||
| 8138 | ✗ | return c; | |
| 8139 | } | ||
| 8140 | |||
| 8141 | // clean up finished samples | ||
| 8142 | 18116708 | void sfx_cleanup() | |
| 8143 | { | ||
| 8144 |
2/2✓ Branch 0 taken 4637877248 times.
✓ Branch 1 taken 18116708 times.
|
4655993956 | for(int32_t i=0; i<WAV_COUNT; i++) |
| 8145 |
3/4✓ Branch 0 taken 1257462 times.
✓ Branch 1 taken 4636619786 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1257462 times.
|
4639134710 | if(sfx_voice[i]!=-1 && voice_get_position(sfx_voice[i])<0) |
| 8146 | { | ||
| 8147 | 1257462 | deallocate_voice(sfx_voice[i]); | |
| 8148 | 1257462 | sfx_voice[i]=-1; | |
| 8149 | 1257462 | } | |
| 8150 | 18116708 | } | |
| 8151 | |||
| 8152 | 1257599 | SAMPLE* sfx_get_sample(int32_t index) | |
| 8153 | { | ||
| 8154 | // check index | ||
| 8155 |
2/4✓ Branch 0 taken 1257599 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1257599 times.
|
1257599 | if (index<=0 || index>=WAV_COUNT) |
| 8156 | ✗ | return nullptr; | |
| 8157 | |||
| 8158 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1257599 times.
|
1257599 | if (sfxdat) |
| 8159 | { | ||
| 8160 | ✗ | if (index<Z35) | |
| 8161 | { | ||
| 8162 | ✗ | return (SAMPLE*)sfxdata[index].dat; | |
| 8163 | } | ||
| 8164 | else | ||
| 8165 | { | ||
| 8166 | ✗ | return (SAMPLE*)sfxdata[Z35].dat; | |
| 8167 | } | ||
| 8168 | } | ||
| 8169 | else | ||
| 8170 | { | ||
| 8171 | 1257599 | return &customsfxdata[index]; | |
| 8172 | } | ||
| 8173 | |||
| 8174 | return nullptr; | ||
| 8175 | 1257599 | } | |
| 8176 | |||
| 8177 | // allocates a voice for the sample "wav_index" (index into zelda.dat) | ||
| 8178 | // if a voice is already allocated (and/or playing), then it just returns true | ||
| 8179 | // Returns true: voice is allocated | ||
| 8180 | // false: unsuccessful | ||
| 8181 | 1848181 | bool sfx_init(int32_t index) | |
| 8182 | { | ||
| 8183 | // check index | ||
| 8184 |
3/4✓ Branch 0 taken 1388315 times.
✓ Branch 1 taken 459866 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1388315 times.
|
1848181 | if(index<=0 || index>=WAV_COUNT) |
| 8185 | 459866 | return false; | |
| 8186 | |||
| 8187 |
2/2✓ Branch 0 taken 130762 times.
✓ Branch 1 taken 1257553 times.
|
1388315 | if (sfx_voice[index] == -1) |
| 8188 | { | ||
| 8189 | 1257553 | SAMPLE* sample = sfx_get_sample(index); | |
| 8190 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1257553 times.
|
1257553 | if (!sample) |
| 8191 | ✗ | return false; | |
| 8192 | |||
| 8193 | 1257553 | sfx_voice[index] = allocate_voice(sample); | |
| 8194 | 1257553 | } | |
| 8195 | |||
| 8196 | 1388315 | return sfx_voice[index] != -1; | |
| 8197 | 1848181 | } | |
| 8198 | |||
| 8199 | 793 | int32_t sfx_get_default_freq(int32_t index) | |
| 8200 | { | ||
| 8201 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 793 times.
|
793 | if (sfxdat) |
| 8202 | { | ||
| 8203 | ✗ | if (index < Z35) | |
| 8204 | { | ||
| 8205 | ✗ | return ((SAMPLE*)sfxdata[index].dat)->freq; | |
| 8206 | } | ||
| 8207 | else | ||
| 8208 | { | ||
| 8209 | ✗ | return ((SAMPLE*)sfxdata[Z35].dat)->freq; | |
| 8210 | } | ||
| 8211 | } | ||
| 8212 | else | ||
| 8213 | { | ||
| 8214 | 793 | return customsfxdata[index].freq; | |
| 8215 | } | ||
| 8216 | 793 | } | |
| 8217 | |||
| 8218 | ✗ | int32_t sfx_get_length(int32_t index) | |
| 8219 | { | ||
| 8220 | ✗ | if (sfxdat) | |
| 8221 | { | ||
| 8222 | ✗ | if (index < Z35) | |
| 8223 | { | ||
| 8224 | ✗ | return int32_t(((SAMPLE*)sfxdata[index].dat)->len); | |
| 8225 | } | ||
| 8226 | else | ||
| 8227 | { | ||
| 8228 | ✗ | return int32_t(((SAMPLE*)sfxdata[Z35].dat)->len); | |
| 8229 | } | ||
| 8230 | } | ||
| 8231 | else | ||
| 8232 | { | ||
| 8233 | ✗ | return int32_t(customsfxdata[index].len); | |
| 8234 | } | ||
| 8235 | ✗ | } | |
| 8236 | |||
| 8237 | // plays an sfx sample | ||
| 8238 | 1848048 | void sfx(int32_t index,int32_t pan,bool loop, bool restart, int32_t vol, int32_t freq) | |
| 8239 | { | ||
| 8240 |
2/2✓ Branch 0 taken 1388245 times.
✓ Branch 1 taken 459803 times.
|
1848048 | if(!sfx_init(index)) |
| 8241 | 459803 | return; | |
| 8242 |
2/2✓ Branch 0 taken 1387452 times.
✓ Branch 1 taken 793 times.
|
1388245 | if (!is_headless()) |
| 8243 | { | ||
| 8244 | 793 | voice_set_playmode(sfx_voice[index], loop ? PLAYMODE_LOOP : PLAYMODE_PLAY); | |
| 8245 | 793 | voice_set_pan(sfx_voice[index], pan); | |
| 8246 | |||
| 8247 | // Only used by ZScript currently | ||
| 8248 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 793 times.
|
793 | if (freq <= -1) |
| 8249 | { | ||
| 8250 | 793 | freq = sfx_get_default_freq(index); | |
| 8251 | 793 | } | |
| 8252 | 793 | voice_set_frequency(sfx_voice[index], freq); | |
| 8253 | |||
| 8254 | // Only used by ZScript currently | ||
| 8255 | 793 | int32_t temp_volume = (sfx_volume * vol) / 10000 / 100; | |
| 8256 |
2/4✓ Branch 0 taken 793 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 793 times.
✗ Branch 3 not taken.
|
793 | if (GameLoaded && !get_qr(qr_OLD_SCRIPT_VOLUME)) |
| 8257 | ✗ | temp_volume = (temp_volume * FFCore.usr_sfx_volume) / 10000 / 100; | |
| 8258 | 793 | voice_set_volume(sfx_voice[index], temp_volume); | |
| 8259 | |||
| 8260 | 793 | int32_t pos = voice_get_position(sfx_voice[index]); | |
| 8261 | |||
| 8262 |
2/2✓ Branch 0 taken 515 times.
✓ Branch 1 taken 278 times.
|
793 | if (restart) voice_set_position(sfx_voice[index], 0); |
| 8263 | |||
| 8264 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 793 times.
|
793 | if (pos <= 0) |
| 8265 | 793 | voice_start(sfx_voice[index]); | |
| 8266 | 793 | } | |
| 8267 | |||
| 8268 |
4/4✓ Branch 0 taken 856526 times.
✓ Branch 1 taken 531719 times.
✓ Branch 2 taken 15 times.
✓ Branch 3 taken 856511 times.
|
1388245 | if (restart && replay_is_debug()) |
| 8269 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 856511 times.
|
856511 | replay_step_comment(fmt::format("sfx {}", sfx_string[index])); |
| 8270 | 1848048 | } | |
| 8271 | |||
| 8272 | // true if sfx is allocated | ||
| 8273 | 199397 | bool sfx_allocated(int32_t index) | |
| 8274 | { | ||
| 8275 |
3/4✓ Branch 0 taken 33965 times.
✓ Branch 1 taken 165432 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 33965 times.
|
199397 | return (index>0 && index<WAV_COUNT && sfx_voice[index]!=-1); |
| 8276 | } | ||
| 8277 | |||
| 8278 | // start it (in loop mode) if it's not already playing, | ||
| 8279 | // otherwise adjust it to play in loop mode -DD | ||
| 8280 | 117057 | void cont_sfx(int32_t index) | |
| 8281 | { | ||
| 8282 |
2/2✓ Branch 0 taken 116924 times.
✓ Branch 1 taken 133 times.
|
117057 | if (is_headless()) |
| 8283 | 116924 | return; | |
| 8284 | |||
| 8285 |
2/2✓ Branch 0 taken 70 times.
✓ Branch 1 taken 63 times.
|
133 | if(!sfx_init(index)) |
| 8286 | { | ||
| 8287 | 63 | return; | |
| 8288 | } | ||
| 8289 | |||
| 8290 |
1/2✓ Branch 0 taken 70 times.
✗ Branch 1 not taken.
|
70 | if(voice_get_position(sfx_voice[index])<=0) |
| 8291 | { | ||
| 8292 | 70 | voice_set_position(sfx_voice[index],0); | |
| 8293 | 70 | voice_set_playmode(sfx_voice[index],PLAYMODE_LOOP); | |
| 8294 | 70 | voice_set_volume(sfx_voice[index], sfx_volume); | |
| 8295 | 70 | voice_start(sfx_voice[index]); | |
| 8296 | 70 | } | |
| 8297 | else | ||
| 8298 | { | ||
| 8299 | ✗ | adjust_sfx(index, 128, true); | |
| 8300 | } | ||
| 8301 | 117057 | } | |
| 8302 | |||
| 8303 | // adjust parameters while playing | ||
| 8304 | 4903 | void adjust_sfx(int32_t index,int32_t pan,bool loop) | |
| 8305 | { | ||
| 8306 |
4/6✓ Branch 0 taken 4467 times.
✓ Branch 1 taken 436 times.
✓ Branch 2 taken 4467 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4467 times.
|
4903 | if(index<=0 || index>=WAV_COUNT || sfx_voice[index]==-1) |
| 8307 | 4903 | return; | |
| 8308 | |||
| 8309 | ✗ | voice_set_playmode(sfx_voice[index],loop?PLAYMODE_LOOP:PLAYMODE_PLAY); | |
| 8310 | ✗ | voice_set_pan(sfx_voice[index],pan); | |
| 8311 | 4903 | } | |
| 8312 | |||
| 8313 | // pauses a voice | ||
| 8314 | 3223 | void pause_sfx(int32_t index) | |
| 8315 | { | ||
| 8316 |
3/6✓ Branch 0 taken 3223 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3223 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 3223 times.
|
3223 | if(index>0 && index<WAV_COUNT && sfx_voice[index]!=-1) |
| 8317 | ✗ | voice_stop(sfx_voice[index]); | |
| 8318 | 3223 | } | |
| 8319 | |||
| 8320 | // resumes a voice | ||
| 8321 | 1360 | void resume_sfx(int32_t index) | |
| 8322 | { | ||
| 8323 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1360 times.
|
1360 | if (is_headless()) |
| 8324 | 1360 | return; | |
| 8325 | |||
| 8326 | ✗ | if(index>0 && index<WAV_COUNT && sfx_voice[index]!=-1) | |
| 8327 | ✗ | voice_start(sfx_voice[index]); | |
| 8328 | 1360 | } | |
| 8329 | |||
| 8330 | // pauses all active voices | ||
| 8331 | 1078 | void pause_all_sfx() | |
| 8332 | { | ||
| 8333 |
2/2✓ Branch 0 taken 275968 times.
✓ Branch 1 taken 1078 times.
|
277046 | for(int32_t i=0; i<WAV_COUNT; i++) |
| 8334 |
2/2✓ Branch 0 taken 275966 times.
✓ Branch 1 taken 2 times.
|
275970 | if(sfx_voice[i]!=-1) |
| 8335 | 2 | voice_stop(sfx_voice[i]); | |
| 8336 | 1078 | } | |
| 8337 | |||
| 8338 | // resumes all paused voices | ||
| 8339 | 1017 | void resume_all_sfx() | |
| 8340 | { | ||
| 8341 |
2/2✓ Branch 0 taken 260352 times.
✓ Branch 1 taken 1017 times.
|
261369 | for(int32_t i=0; i<WAV_COUNT; i++) |
| 8342 |
1/2✓ Branch 0 taken 260352 times.
✗ Branch 1 not taken.
|
260352 | if(sfx_voice[i]!=-1) |
| 8343 | ✗ | voice_start(sfx_voice[i]); | |
| 8344 | 1017 | } | |
| 8345 | |||
| 8346 | // stops an sfx and deallocates the voice | ||
| 8347 | 14490469 | void stop_sfx(int32_t index) | |
| 8348 | { | ||
| 8349 |
3/4✓ Branch 0 taken 14244146 times.
✓ Branch 1 taken 246323 times.
✓ Branch 2 taken 14244146 times.
✗ Branch 3 not taken.
|
14490469 | if(index<=0 || index>=WAV_COUNT) |
| 8350 | 246323 | return; | |
| 8351 | |||
| 8352 |
2/2✓ Branch 0 taken 33 times.
✓ Branch 1 taken 14244113 times.
|
14244146 | if(sfx_voice[index]!=-1) |
| 8353 | { | ||
| 8354 | 33 | deallocate_voice(sfx_voice[index]); | |
| 8355 | 33 | sfx_voice[index]=-1; | |
| 8356 | 33 | } | |
| 8357 | 14490469 | } | |
| 8358 | |||
| 8359 | // Stops SFX played by Hero's item of the given family | ||
| 8360 | 130619 | void stop_item_sfx(int32_t family) | |
| 8361 | { | ||
| 8362 | 130619 | int32_t id=current_item_id(family); | |
| 8363 | |||
| 8364 |
2/2✓ Branch 0 taken 129519 times.
✓ Branch 1 taken 1100 times.
|
130619 | if(id<0) |
| 8365 | 129519 | return; | |
| 8366 | |||
| 8367 | 1100 | stop_sfx(itemsbuf[id].usesound); | |
| 8368 | 130619 | } | |
| 8369 | |||
| 8370 | 9207 | void kill_sfx() | |
| 8371 | { | ||
| 8372 |
2/2✓ Branch 0 taken 2356992 times.
✓ Branch 1 taken 9207 times.
|
2366199 | for(int32_t i=0; i<WAV_COUNT; i++) |
| 8373 |
2/2✓ Branch 0 taken 2356934 times.
✓ Branch 1 taken 58 times.
|
2357050 | if(sfx_voice[i]!=-1) |
| 8374 | { | ||
| 8375 | 58 | deallocate_voice(sfx_voice[i]); | |
| 8376 | 58 | sfx_voice[i]=-1; | |
| 8377 | 58 | } | |
| 8378 | 9207 | } | |
| 8379 | |||
| 8380 | 1172997 | int32_t pan(int32_t x) | |
| 8381 | { | ||
| 8382 |
1/4✓ Branch 0 taken 1172997 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1172997 | switch(pan_style) |
| 8383 | { | ||
| 8384 | case 0: | ||
| 8385 | ✗ | return 128; | |
| 8386 | |||
| 8387 | case 1: | ||
| 8388 | 1172997 | return vbound((x>>1)+68,0,255); | |
| 8389 | |||
| 8390 | case 2: | ||
| 8391 | ✗ | return vbound(((x*3)>>2)+36,0,255); | |
| 8392 | } | ||
| 8393 | |||
| 8394 | ✗ | return vbound(x,0,255); | |
| 8395 | 1172997 | } | |
| 8396 | |||
| 8397 | 49876922 | bool joybtn(int32_t b) | |
| 8398 | { | ||
| 8399 |
1/2✓ Branch 0 taken 49876922 times.
✗ Branch 1 not taken.
|
49876922 | if(b == 0) |
| 8400 | ✗ | return false; | |
| 8401 |
1/2✓ Branch 0 taken 49876922 times.
✗ Branch 1 not taken.
|
49876922 | if (b-1 >= joy[joystick_index].num_buttons) |
| 8402 | 49876922 | return false; | |
| 8403 | |||
| 8404 | ✗ | return joy[joystick_index].button[b-1].b !=0; | |
| 8405 | 49876922 | } | |
| 8406 | |||
| 8407 | ✗ | bool joystick(int32_t s) | |
| 8408 | { | ||
| 8409 | ✗ | if(s < 0) | |
| 8410 | ✗ | return false; | |
| 8411 | ✗ | if (s >= joy[joystick_index].num_sticks) | |
| 8412 | ✗ | return false; | |
| 8413 | |||
| 8414 | ✗ | for (int i = 0; i < joy[joystick_index].stick[s].num_axis; i++) | |
| 8415 | { | ||
| 8416 | ✗ | if (joy[joystick_index].stick[s].axis[i].d1 || joy[joystick_index].stick[s].axis[i].d2) | |
| 8417 | ✗ | return true; | |
| 8418 | ✗ | } | |
| 8419 | ✗ | return false; | |
| 8420 | ✗ | } | |
| 8421 | |||
| 8422 | ✗ | const char* joybtn_name(int32_t b) | |
| 8423 | { | ||
| 8424 | ✗ | if (b <= 0 || b > joy[joystick_index].num_buttons) | |
| 8425 | ✗ | return ""; | |
| 8426 | |||
| 8427 | ✗ | return joy[joystick_index].button[b-1].name; | |
| 8428 | ✗ | } | |
| 8429 | |||
| 8430 | ✗ | const char* joystick_name(int32_t s) | |
| 8431 | { | ||
| 8432 | ✗ | if (s < 0 || s >= joy[joystick_index].num_sticks) | |
| 8433 | ✗ | return ""; | |
| 8434 | |||
| 8435 | ✗ | return joy[joystick_index].stick[s].name; | |
| 8436 | ✗ | } | |
| 8437 | |||
| 8438 | ✗ | int32_t button_pressed() | |
| 8439 | { | ||
| 8440 | ✗ | if (joystick_index >= MAX_JOYSTICKS) | |
| 8441 | ✗ | return 0; | |
| 8442 | |||
| 8443 | ✗ | for(int32_t i=1; i<=joy[joystick_index].num_buttons; i++) | |
| 8444 | { | ||
| 8445 | ✗ | if(joybtn(i)) | |
| 8446 | ✗ | return i; | |
| 8447 | ✗ | } | |
| 8448 | |||
| 8449 | ✗ | return 0; | |
| 8450 | ✗ | } | |
| 8451 | |||
| 8452 | int32_t next_press_key(); | ||
| 8453 | |||
| 8454 | ✗ | int32_t next_joy_input(bool buttons) | |
| 8455 | { | ||
| 8456 | ✗ | clear_keybuf(); | |
| 8457 | |||
| 8458 | //first, we need to wait until they're pressing no buttons | ||
| 8459 | ✗ | for(;;) | |
| 8460 | { | ||
| 8461 | ✗ | if(keypressed()) | |
| 8462 | { | ||
| 8463 | ✗ | switch(readkey()>>8) | |
| 8464 | { | ||
| 8465 | case KEY_ESC: | ||
| 8466 | ✗ | return -1; | |
| 8467 | |||
| 8468 | case KEY_SPACE: | ||
| 8469 | ✗ | return 0; | |
| 8470 | } | ||
| 8471 | ✗ | } | |
| 8472 | |||
| 8473 | ✗ | poll_joystick(); | |
| 8474 | ✗ | bool done = true; | |
| 8475 | |||
| 8476 | ✗ | if (buttons) | |
| 8477 | { | ||
| 8478 | ✗ | for(int32_t i=1; i<=joy[joystick_index].num_buttons; i++) | |
| 8479 | { | ||
| 8480 | ✗ | if(joybtn(i)) done = false; | |
| 8481 | ✗ | } | |
| 8482 | ✗ | } | |
| 8483 | else | ||
| 8484 | { | ||
| 8485 | ✗ | if (!gamepad_dlg_cur_joystick || !al_get_joystick_active(gamepad_dlg_cur_joystick)) | |
| 8486 | { | ||
| 8487 | ✗ | InfoDialog("ZC", "Invalid gamepad. Did it disconnect?").show(); | |
| 8488 | ✗ | return -2; | |
| 8489 | } | ||
| 8490 | ✗ | for(int32_t i=0; i<joy[joystick_index].num_sticks; i++) | |
| 8491 | { | ||
| 8492 | ✗ | if(joystick(i)) done = false; | |
| 8493 | ✗ | } | |
| 8494 | } | ||
| 8495 | |||
| 8496 | ✗ | if(done) break; | |
| 8497 | ✗ | rest(1); | |
| 8498 | } | ||
| 8499 | |||
| 8500 | //now, we need to wait for them to press any button | ||
| 8501 | ✗ | for(;;) | |
| 8502 | { | ||
| 8503 | ✗ | if(keypressed()) | |
| 8504 | { | ||
| 8505 | ✗ | switch(readkey()>>8) | |
| 8506 | { | ||
| 8507 | case KEY_ESC: | ||
| 8508 | ✗ | return -1; | |
| 8509 | |||
| 8510 | case KEY_SPACE: | ||
| 8511 | ✗ | return 0; | |
| 8512 | } | ||
| 8513 | ✗ | } | |
| 8514 | |||
| 8515 | ✗ | poll_joystick(); | |
| 8516 | |||
| 8517 | ✗ | if (buttons) | |
| 8518 | { | ||
| 8519 | ✗ | if (!gamepad_dlg_cur_joystick || !al_get_joystick_active(gamepad_dlg_cur_joystick)) | |
| 8520 | { | ||
| 8521 | ✗ | InfoDialog("ZC", "Invalid gamepad. Did it disconnect?").show(); | |
| 8522 | ✗ | return -2; | |
| 8523 | } | ||
| 8524 | ✗ | for(int32_t i=1; i<=joy[joystick_index].num_buttons; i++) | |
| 8525 | { | ||
| 8526 | ✗ | if(joybtn(i)) | |
| 8527 | ✗ | return i; | |
| 8528 | ✗ | } | |
| 8529 | ✗ | } | |
| 8530 | else | ||
| 8531 | { | ||
| 8532 | ✗ | for(int32_t i=0; i<joy[joystick_index].num_sticks; i++) | |
| 8533 | { | ||
| 8534 | ✗ | if(joystick(i)) | |
| 8535 | ✗ | return i; | |
| 8536 | ✗ | } | |
| 8537 | } | ||
| 8538 | ✗ | rest(1); | |
| 8539 | } | ||
| 8540 | ✗ | } | |
| 8541 | |||
| 8542 | 7401186 | static bool rButton(bool &btn, bool &flag, bool rawbtn) | |
| 8543 | { | ||
| 8544 |
2/2✓ Branch 0 taken 7374901 times.
✓ Branch 1 taken 26285 times.
|
7401186 | bool ret = btn && !flag; |
| 8545 | 7401186 | flag = rawbtn; | |
| 8546 | |||
| 8547 | 7401186 | return ret; | |
| 8548 | } | ||
| 8549 | 373569157 | static bool rButton(bool &btn, bool &flag) | |
| 8550 | { | ||
| 8551 |
2/2✓ Branch 0 taken 359800763 times.
✓ Branch 1 taken 13768394 times.
|
373569157 | bool ret = btn && !flag; |
| 8552 | 373569157 | flag = btn; | |
| 8553 | |||
| 8554 | 373569157 | return ret; | |
| 8555 | } | ||
| 8556 | 4577206 | static bool rButtonPeek(bool btn, bool flag) | |
| 8557 | { | ||
| 8558 |
2/2✓ Branch 0 taken 4236933 times.
✓ Branch 1 taken 340273 times.
|
4577206 | if(!btn) |
| 8559 | { | ||
| 8560 | 4236933 | return false; | |
| 8561 | } | ||
| 8562 |
2/2✓ Branch 0 taken 33326 times.
✓ Branch 1 taken 306947 times.
|
340273 | else if(!flag) |
| 8563 | { | ||
| 8564 | 33326 | return true; | |
| 8565 | } | ||
| 8566 | |||
| 8567 | 306947 | return false; | |
| 8568 | 4577206 | } | |
| 8569 | |||
| 8570 | // Updated only by keyboard/gamepad. | ||
| 8571 | // If in replay mode, this is set directly by the replay system. | ||
| 8572 | // This should never be read from directly - use control_state instead. | ||
| 8573 | bool raw_control_state[ZC_CONTROL_STATES]; | ||
| 8574 | |||
| 8575 | // Every call to load_control_state (pretty much every frame) resets this to be equal to raw_control_state. | ||
| 8576 | // This state can drift from raw_control_state if button states are "eaten" or overriden by a script. But that only | ||
| 8577 | // lasts until the next call to load_control_state. | ||
| 8578 | bool control_state[ZC_CONTROL_STATES]; | ||
| 8579 | bool disable_control[ZC_CONTROL_STATES]; | ||
| 8580 | bool drunk_toggle_state[11]; | ||
| 8581 | bool disabledKeys[127]; | ||
| 8582 | bool KeyInput[127]; | ||
| 8583 | bool KeyPress[127]; | ||
| 8584 | |||
| 8585 | bool key_current_frame[127]; | ||
| 8586 | bool key_previous_frame[127]; | ||
| 8587 | |||
| 8588 | static bool key_system[127]; | ||
| 8589 | static bool key_system_previous[127]; | ||
| 8590 | static bool key_system_press[127]; | ||
| 8591 | |||
| 8592 | bool button_press[ZC_CONTROL_STATES]; | ||
| 8593 | bool button_hold[ZC_CONTROL_STATES]; | ||
| 8594 | |||
| 8595 | #define STICK_1_X joy[joystick_index].stick[js_stick_1_x_stick].axis[js_stick_1_x_axis] | ||
| 8596 | #define STICK_1_Y joy[joystick_index].stick[js_stick_1_y_stick].axis[js_stick_1_y_axis] | ||
| 8597 | #define STICK_2_X joy[joystick_index].stick[js_stick_2_x_stick].axis[js_stick_2_x_axis] | ||
| 8598 | #define STICK_2_Y joy[joystick_index].stick[js_stick_2_y_stick].axis[js_stick_2_y_axis] | ||
| 8599 | #define STICK_PRECISION 56 //define your own sensitivity | ||
| 8600 | |||
| 8601 | 15508139 | void load_control_state() | |
| 8602 | { | ||
| 8603 | 15508139 | load_control_called_this_frame = true; | |
| 8604 | |||
| 8605 |
2/2✓ Branch 0 taken 12378507 times.
✓ Branch 1 taken 3129632 times.
|
15508139 | if (replay_version_check(8, 11)) |
| 8606 | { | ||
| 8607 |
2/2✓ Branch 0 taken 56333376 times.
✓ Branch 1 taken 3129632 times.
|
59463008 | for (int i = 0; i < ZC_CONTROL_STATES; i++) |
| 8608 | 56333376 | down_control_states[i] = raw_control_state[i]; | |
| 8609 | 3129632 | } | |
| 8610 | |||
| 8611 |
2/2✓ Branch 0 taken 15508118 times.
✓ Branch 1 taken 21 times.
|
15508139 | if (!replay_is_replaying()) |
| 8612 | { | ||
| 8613 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
✓ Branch 2 taken 21 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 21 times.
✗ Branch 5 not taken.
|
21 | raw_control_state[0]=zc_getrawkey(DUkey, true)||(analog_movement ? STICK_1_Y.d1 || STICK_1_Y.pos - js_stick_1_y_offset < -STICK_PRECISION : joybtn(DUbtn)); |
| 8614 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
✓ Branch 2 taken 21 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 21 times.
✗ Branch 5 not taken.
|
21 | raw_control_state[1]=zc_getrawkey(DDkey, true)||(analog_movement ? STICK_1_Y.d2 || STICK_1_Y.pos - js_stick_1_y_offset > STICK_PRECISION : joybtn(DDbtn)); |
| 8615 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
✓ Branch 2 taken 21 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 21 times.
✗ Branch 5 not taken.
|
21 | raw_control_state[2]=zc_getrawkey(DLkey, true)||(analog_movement ? STICK_1_X.d1 || STICK_1_X.pos - js_stick_1_x_offset < -STICK_PRECISION : joybtn(DLbtn)); |
| 8616 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
✓ Branch 2 taken 21 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 21 times.
✗ Branch 5 not taken.
|
21 | raw_control_state[3]=zc_getrawkey(DRkey, true)||(analog_movement ? STICK_1_X.d2 || STICK_1_X.pos - js_stick_1_x_offset > STICK_PRECISION : joybtn(DRbtn)); |
| 8617 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
|
21 | raw_control_state[4]=zc_getrawkey(Akey, true)||joybtn(Abtn); |
| 8618 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
|
21 | raw_control_state[5]=zc_getrawkey(Bkey, true)||joybtn(Bbtn); |
| 8619 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
|
21 | raw_control_state[6]=zc_getrawkey(Skey, true)||joybtn(Sbtn); |
| 8620 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
|
21 | raw_control_state[7]=zc_getrawkey(Lkey, true)||joybtn(Lbtn); |
| 8621 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
|
21 | raw_control_state[8]=zc_getrawkey(Rkey, true)||joybtn(Rbtn); |
| 8622 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
|
21 | raw_control_state[9]=zc_getrawkey(Pkey, true)||joybtn(Pbtn); |
| 8623 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
|
21 | raw_control_state[10]=zc_getrawkey(Exkey1, true)||joybtn(Exbtn1); |
| 8624 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
|
21 | raw_control_state[11]=zc_getrawkey(Exkey2, true)||joybtn(Exbtn2); |
| 8625 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
|
21 | raw_control_state[12]=zc_getrawkey(Exkey3, true)||joybtn(Exbtn3); |
| 8626 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
|
21 | raw_control_state[13]=zc_getrawkey(Exkey4, true)||joybtn(Exbtn4); |
| 8627 | |||
| 8628 |
1/2✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
|
21 | if(num_joysticks != 0) |
| 8629 | { | ||
| 8630 | ✗ | raw_control_state[14] = STICK_2_Y.pos - js_stick_2_y_offset < -STICK_PRECISION; | |
| 8631 | ✗ | raw_control_state[15] = STICK_2_Y.pos - js_stick_2_y_offset > STICK_PRECISION; | |
| 8632 | ✗ | raw_control_state[16] = STICK_2_X.pos - js_stick_2_x_offset < -STICK_PRECISION; | |
| 8633 | ✗ | raw_control_state[17] = STICK_2_X.pos - js_stick_2_x_offset > STICK_PRECISION; | |
| 8634 | ✗ | } | |
| 8635 | else | ||
| 8636 | { | ||
| 8637 | 21 | raw_control_state[14] = false; | |
| 8638 | 21 | raw_control_state[15] = false; | |
| 8639 | 21 | raw_control_state[16] = false; | |
| 8640 | 21 | raw_control_state[17] = false; | |
| 8641 | } | ||
| 8642 | 21 | } | |
| 8643 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 15508134 times.
|
15508139 | if (replay_is_active()) |
| 8644 | { | ||
| 8645 |
2/2✓ Branch 0 taken 1211700 times.
✓ Branch 1 taken 14296434 times.
|
15508134 | if (replay_get_version() < 3) |
| 8646 | 1211700 | replay_poll(); | |
| 8647 |
4/4✓ Branch 0 taken 14296413 times.
✓ Branch 1 taken 21 times.
✓ Branch 2 taken 12534419 times.
✓ Branch 3 taken 1761994 times.
|
14296434 | else if (replay_is_replaying() && replay_get_version() < 6) |
| 8648 | 1761994 | replay_peek_input(); | |
| 8649 |
4/4✓ Branch 0 taken 12534419 times.
✓ Branch 1 taken 21 times.
✓ Branch 2 taken 9404787 times.
✓ Branch 3 taken 3129632 times.
|
12534440 | else if (replay_is_replaying() && replay_version_check(8, 11)) |
| 8650 | 3129632 | replay_peek_input(); | |
| 8651 |
2/2✓ Branch 0 taken 14241622 times.
✓ Branch 1 taken 1266512 times.
|
15508134 | if (replay_get_version() == 8) |
| 8652 | 1266512 | update_keys(); | |
| 8653 | 15508134 | } | |
| 8654 | |||
| 8655 | // Some test replay files were made before a serious input bug was fixed, so instead | ||
| 8656 | // of re-doing them or tossing them out, just check for that zplay version. | ||
| 8657 |
3/4✓ Branch 0 taken 15508129 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 121900 times.
✓ Branch 3 taken 15386229 times.
|
15508139 | bool botched_input = replay_is_active() && replay_get_version() != 1 && replay_get_version() < 8; |
| 8658 |
2/2✓ Branch 0 taken 279146322 times.
✓ Branch 1 taken 15508129 times.
|
294654451 | for (int i = 0; i < ZC_CONTROL_STATES; i++) |
| 8659 | { | ||
| 8660 | 279146322 | control_state[i] = raw_control_state[i]; | |
| 8661 |
4/4✓ Branch 0 taken 53035164 times.
✓ Branch 1 taken 226111158 times.
✓ Branch 2 taken 2612094 times.
✓ Branch 3 taken 50423070 times.
|
279146322 | if (botched_input && !control_state[i]) |
| 8662 | 50423070 | down_control_states[i] = false; | |
| 8663 | 279146322 | } | |
| 8664 | 15508129 | bool did_bad_cutscene_btn = false; | |
| 8665 |
2/2✓ Branch 0 taken 15508129 times.
✓ Branch 1 taken 279146322 times.
|
294654451 | for(int q = 0; q < 18; ++q) |
| 8666 |
4/4✓ Branch 0 taken 13202084 times.
✓ Branch 1 taken 265944238 times.
✓ Branch 2 taken 13199767 times.
✓ Branch 3 taken 2317 times.
|
279148639 | if(control_state[q] && !active_cutscene.can_button(q)) |
| 8667 | { | ||
| 8668 | 2317 | control_state[q] = false; | |
| 8669 | 2317 | did_bad_cutscene_btn = true; | |
| 8670 | 2317 | } | |
| 8671 |
2/2✓ Branch 0 taken 15506469 times.
✓ Branch 1 taken 1660 times.
|
15508129 | if(did_bad_cutscene_btn) |
| 8672 | 1660 | active_cutscene.error(); | |
| 8673 | |||
| 8674 | 15508129 | button_press[0]=rButton(control_state[0],button_hold[0]); | |
| 8675 | 15508129 | button_press[1]=rButton(control_state[1],button_hold[1]); | |
| 8676 | 15508129 | button_press[2]=rButton(control_state[2],button_hold[2]); | |
| 8677 | 15508129 | button_press[3]=rButton(control_state[3],button_hold[3]); | |
| 8678 | 15508129 | button_press[4]=rButton(control_state[4],button_hold[4]); | |
| 8679 | 15508129 | button_press[5]=rButton(control_state[5],button_hold[5]); | |
| 8680 | 15508129 | button_press[6]=rButton(control_state[6],button_hold[6]); | |
| 8681 | 15508129 | button_press[7]=rButton(control_state[7],button_hold[7]); | |
| 8682 | 15508129 | button_press[8]=rButton(control_state[8],button_hold[8]); | |
| 8683 | 15508129 | button_press[9]=rButton(control_state[9],button_hold[9]); | |
| 8684 | 15508129 | button_press[10]=rButton(control_state[10],button_hold[10]); | |
| 8685 | 15508129 | button_press[11]=rButton(control_state[11],button_hold[11]); | |
| 8686 | 15508129 | button_press[12]=rButton(control_state[12],button_hold[12]); | |
| 8687 | 15508129 | button_press[13]=rButton(control_state[13],button_hold[13]); | |
| 8688 | 15508129 | button_press[14]=rButton(control_state[14],button_hold[14]); | |
| 8689 | 15508129 | button_press[15]=rButton(control_state[15],button_hold[15]); | |
| 8690 | 15508129 | button_press[16]=rButton(control_state[16],button_hold[16]); | |
| 8691 | 15508129 | button_press[17]=rButton(control_state[17],button_hold[17]); | |
| 8692 | 15508129 | } | |
| 8693 | |||
| 8694 | // Returns true if any game key is pressed. This is needed because keypressed() | ||
| 8695 | // doesn't detect modifier keys and control_state[] can be modified by scripts. | ||
| 8696 | 77845578 | bool zc_key_pressed() | |
| 8697 | //may also need to use zc_getrawkey | ||
| 8698 | { | ||
| 8699 |
7/10✓ Branch 0 taken 62864248 times.
✓ Branch 1 taken 14981330 times.
✓ Branch 2 taken 14981330 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 14981330 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 12266152 times.
✓ Branch 7 taken 12266152 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 4908815 times.
|
82754393 | if((zc_getrawkey(DUkey, true)||(analog_movement ? STICK_1_Y.d1 || STICK_1_Y.pos - js_stick_1_y_offset< -STICK_PRECISION : joybtn(DUbtn))) || |
| 8700 |
4/6✓ Branch 0 taken 12266152 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12266152 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 9338222 times.
✓ Branch 5 taken 9338222 times.
|
12266152 | (zc_getrawkey(DDkey, true)||(analog_movement ? STICK_1_Y.d2 || STICK_1_Y.pos - js_stick_1_y_offset > STICK_PRECISION : joybtn(DDbtn))) || |
| 8701 |
4/6✓ Branch 0 taken 9338222 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9338222 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6187206 times.
✓ Branch 5 taken 6187206 times.
|
9338222 | (zc_getrawkey(DLkey, true)||(analog_movement ? STICK_1_X.d1 || STICK_1_X.pos - js_stick_1_x_offset < -STICK_PRECISION : joybtn(DLbtn))) || |
| 8702 |
4/6✓ Branch 0 taken 6187206 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6187206 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5312537 times.
✓ Branch 5 taken 5312537 times.
|
6187206 | (zc_getrawkey(DRkey, true)||(analog_movement ? STICK_1_X.d2 || STICK_1_X.pos - js_stick_1_x_offset > STICK_PRECISION : joybtn(DRbtn))) || |
| 8703 |
1/2✓ Branch 0 taken 5312537 times.
✗ Branch 1 not taken.
|
5312537 | (zc_getrawkey(Akey, true)||joybtn(Abtn)) || |
| 8704 |
3/4✓ Branch 0 taken 5126789 times.
✓ Branch 1 taken 185748 times.
✓ Branch 2 taken 5126789 times.
✗ Branch 3 not taken.
|
5312537 | (zc_getrawkey(Bkey, true)||joybtn(Bbtn)) || |
| 8705 |
3/4✓ Branch 0 taken 4980661 times.
✓ Branch 1 taken 146128 times.
✓ Branch 2 taken 4980661 times.
✗ Branch 3 not taken.
|
5126789 | (zc_getrawkey(Skey, true)||joybtn(Sbtn)) || |
| 8706 |
3/4✓ Branch 0 taken 4959791 times.
✓ Branch 1 taken 20870 times.
✓ Branch 2 taken 4959791 times.
✗ Branch 3 not taken.
|
4980661 | (zc_getrawkey(Lkey, true)||joybtn(Lbtn)) || |
| 8707 |
3/4✓ Branch 0 taken 4933432 times.
✓ Branch 1 taken 26359 times.
✓ Branch 2 taken 4933432 times.
✗ Branch 3 not taken.
|
4959791 | (zc_getrawkey(Rkey, true)||joybtn(Rbtn)) || |
| 8708 |
3/4✓ Branch 0 taken 4926147 times.
✓ Branch 1 taken 7285 times.
✓ Branch 2 taken 4926147 times.
✗ Branch 3 not taken.
|
4933432 | (zc_getrawkey(Pkey, true)||joybtn(Pbtn)) || |
| 8709 |
3/4✓ Branch 0 taken 4910757 times.
✓ Branch 1 taken 15390 times.
✓ Branch 2 taken 4910757 times.
✗ Branch 3 not taken.
|
4926147 | (zc_getrawkey(Exkey1, true)||joybtn(Exbtn1)) || |
| 8710 |
3/4✓ Branch 0 taken 4908909 times.
✓ Branch 1 taken 1848 times.
✓ Branch 2 taken 4908909 times.
✗ Branch 3 not taken.
|
4910757 | (zc_getrawkey(Exkey2, true)||joybtn(Exbtn2)) || |
| 8711 |
3/4✓ Branch 0 taken 4908874 times.
✓ Branch 1 taken 35 times.
✓ Branch 2 taken 4908874 times.
✗ Branch 3 not taken.
|
4908909 | (zc_getrawkey(Exkey3, true)||joybtn(Exbtn3)) || |
| 8712 |
2/2✓ Branch 0 taken 4908815 times.
✓ Branch 1 taken 59 times.
|
4908874 | (zc_getrawkey(Exkey4, true)||joybtn(Exbtn4))) // Skipping joystick axes |
| 8713 | 139144997 | return true; | |
| 8714 | |||
| 8715 | 4908815 | return false; | |
| 8716 | 18325316 | } | |
| 8717 | |||
| 8718 | 294871330 | bool getInput(int32_t btn, bool press, bool drunk, bool ignoreDisable, bool eatEntirely, bool peek) | |
| 8719 | { | ||
| 8720 | 294871330 | bool ret = false, drunkstate = false, rawret = false;; | |
| 8721 | 294871330 | bool* flag = &down_control_states[btn]; | |
| 8722 |
2/7✓ Branch 0 taken 276527205 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 18344125 times.
|
294871330 | switch(btn) |
| 8723 | { | ||
| 8724 | case btnF12: | ||
| 8725 | ✗ | ret = zc_getkey(KEY_F12, ignoreDisable); | |
| 8726 | ✗ | rawret = zc_getrawkey(KEY_F12, ignoreDisable); | |
| 8727 | ✗ | eatEntirely = false; | |
| 8728 | ✗ | break; | |
| 8729 | case btnF11: | ||
| 8730 | ✗ | ret = zc_getkey(KEY_F11, ignoreDisable); | |
| 8731 | ✗ | rawret = zc_getrawkey(KEY_F11, ignoreDisable); | |
| 8732 | ✗ | eatEntirely = false; | |
| 8733 | ✗ | break; | |
| 8734 | case btnF5: | ||
| 8735 | ✗ | ret = zc_getkey(KEY_F5, ignoreDisable); | |
| 8736 | ✗ | rawret = zc_getrawkey(KEY_F5, ignoreDisable); | |
| 8737 | ✗ | eatEntirely = false; | |
| 8738 | ✗ | break; | |
| 8739 | case btnQ: | ||
| 8740 | ✗ | ret = zc_getkey(KEY_Q, ignoreDisable); | |
| 8741 | ✗ | rawret = zc_getrawkey(KEY_Q, ignoreDisable); | |
| 8742 | ✗ | eatEntirely = false; | |
| 8743 | ✗ | break; | |
| 8744 | case btnI: | ||
| 8745 | ✗ | ret = zc_getkey(KEY_I, ignoreDisable); | |
| 8746 | ✗ | rawret = zc_getrawkey(KEY_I, ignoreDisable); | |
| 8747 | ✗ | eatEntirely = false; | |
| 8748 | ✗ | break; | |
| 8749 | case btnM: | ||
| 8750 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18344125 times.
|
18344125 | if(FFCore.kb_typing_mode) return false; |
| 8751 | 18344125 | rawret = ret = zc_getrawkey(KEY_ESC, ignoreDisable); | |
| 8752 | 18344125 | eatEntirely = false; | |
| 8753 | 18344125 | break; | |
| 8754 | default: //control_state[] index | ||
| 8755 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 276527205 times.
|
276527205 | if(FFCore.kb_typing_mode) return false; |
| 8756 |
6/6✓ Branch 0 taken 275162915 times.
✓ Branch 1 taken 1364290 times.
✓ Branch 2 taken 16841478 times.
✓ Branch 3 taken 258321437 times.
✓ Branch 4 taken 16841325 times.
✓ Branch 5 taken 153 times.
|
276527205 | if(!ignoreDisable && get_qr(qr_FIXDRUNKINPUTS) && disable_control[btn]) drunk = false; |
| 8757 |
2/2✓ Branch 0 taken 15739600 times.
✓ Branch 1 taken 260787452 times.
|
276527052 | else if(btn<11) drunkstate = drunk_toggle_state[btn]; |
| 8758 |
4/4✓ Branch 0 taken 245719699 times.
✓ Branch 1 taken 30807506 times.
✓ Branch 2 taken 5480 times.
✓ Branch 3 taken 30802026 times.
|
307334711 | ret = control_state[btn] && (ignoreDisable || !disable_control[btn]); |
| 8759 | 276527205 | rawret = raw_control_state[btn]; | |
| 8760 | 276527205 | } | |
| 8761 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 294871330 times.
|
294871330 | assert(flag); |
| 8762 |
2/2✓ Branch 0 taken 188470103 times.
✓ Branch 1 taken 106401227 times.
|
294871330 | if(press) |
| 8763 | { | ||
| 8764 |
2/2✓ Branch 0 taken 4577206 times.
✓ Branch 1 taken 101824021 times.
|
106401227 | if(peek) |
| 8765 | 4577206 | ret = rButtonPeek(ret, *flag); | |
| 8766 |
2/2✓ Branch 0 taken 94422835 times.
✓ Branch 1 taken 7401186 times.
|
101824021 | else if(get_qr(qr_BROKEN_INPUT_DOWN_STATE)) ret = rButton(ret, *flag); |
| 8767 | 7401186 | else ret = rButton(ret, *flag, rawret); | |
| 8768 | 106401227 | } | |
| 8769 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 294871330 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
294871330 | if(eatEntirely && ret) control_state[btn] = false; |
| 8770 |
4/4✓ Branch 0 taken 220328182 times.
✓ Branch 1 taken 74543148 times.
✓ Branch 2 taken 220328101 times.
✓ Branch 3 taken 81 times.
|
294871330 | if(drunk && drunkstate) ret = !ret; |
| 8771 | 294871330 | return ret; | |
| 8772 | 294871330 | } | |
| 8773 | |||
| 8774 | 14815502 | byte getIntBtnInput(byte intbtn, bool press, bool drunk, bool ignoreDisable, bool eatEntirely, bool peek) | |
| 8775 | { | ||
| 8776 | 14815502 | byte ret = 0; | |
| 8777 |
2/2✓ Branch 0 taken 10461209 times.
✓ Branch 1 taken 4354293 times.
|
14815502 | if(intbtn & INT_BTN_A) ret |= getInput(btnA, press, drunk, ignoreDisable, eatEntirely, peek) ? INT_BTN_A : 0; |
| 8778 |
2/2✓ Branch 0 taken 14608273 times.
✓ Branch 1 taken 207229 times.
|
14815502 | if(intbtn & INT_BTN_B) ret |= getInput(btnB, press, drunk, ignoreDisable, eatEntirely, peek) ? INT_BTN_B : 0; |
| 8779 |
2/2✓ Branch 0 taken 14608720 times.
✓ Branch 1 taken 206782 times.
|
14815502 | if(intbtn & INT_BTN_L) ret |= getInput(btnL, press, drunk, ignoreDisable, eatEntirely, peek) ? INT_BTN_L : 0; |
| 8780 |
2/2✓ Branch 0 taken 14608720 times.
✓ Branch 1 taken 206782 times.
|
14815502 | if(intbtn & INT_BTN_R) ret |= getInput(btnR, press, drunk, ignoreDisable, eatEntirely, peek) ? INT_BTN_R : 0; |
| 8781 |
2/2✓ Branch 0 taken 14608720 times.
✓ Branch 1 taken 206782 times.
|
14815502 | if(intbtn & INT_BTN_EX1) ret |= getInput(btnEx1, press, drunk, ignoreDisable, eatEntirely, peek) ? INT_BTN_EX1 : 0; |
| 8782 |
2/2✓ Branch 0 taken 14608720 times.
✓ Branch 1 taken 206782 times.
|
14815502 | if(intbtn & INT_BTN_EX2) ret |= getInput(btnEx2, press, drunk, ignoreDisable, eatEntirely, peek) ? INT_BTN_EX2 : 0; |
| 8783 |
2/2✓ Branch 0 taken 14608720 times.
✓ Branch 1 taken 206782 times.
|
14815502 | if(intbtn & INT_BTN_EX3) ret |= getInput(btnEx3, press, drunk, ignoreDisable, eatEntirely, peek) ? INT_BTN_EX3 : 0; |
| 8784 |
2/2✓ Branch 0 taken 14608605 times.
✓ Branch 1 taken 206897 times.
|
14815502 | if(intbtn & INT_BTN_EX4) ret |= getInput(btnEx4, press, drunk, ignoreDisable, eatEntirely, peek) ? INT_BTN_EX4 : 0; |
| 8785 | 14815502 | return ret; //No early return, to make sure all button presses are eaten that should be! -Em | |
| 8786 | } | ||
| 8787 | |||
| 8788 | 7515 | byte checkIntBtnVal(byte intbtn, byte vals) | |
| 8789 | { | ||
| 8790 | 7515 | return intbtn&vals; | |
| 8791 | } | ||
| 8792 | |||
| 8793 | 3711649 | bool Up() | |
| 8794 | { | ||
| 8795 | 3711649 | return getInput(btnUp); | |
| 8796 | } | ||
| 8797 | 728445 | bool Down() | |
| 8798 | { | ||
| 8799 | 728445 | return getInput(btnDown); | |
| 8800 | } | ||
| 8801 | 982865 | bool Left() | |
| 8802 | { | ||
| 8803 | 982865 | return getInput(btnLeft); | |
| 8804 | } | ||
| 8805 | 1044199 | bool Right() | |
| 8806 | { | ||
| 8807 | 1044199 | return getInput(btnRight); | |
| 8808 | } | ||
| 8809 | 532139 | bool cAbtn() | |
| 8810 | { | ||
| 8811 | 532139 | return getInput(btnA); | |
| 8812 | } | ||
| 8813 | 3306978 | bool cBbtn() | |
| 8814 | { | ||
| 8815 | 3306978 | return getInput(btnB); | |
| 8816 | } | ||
| 8817 | ✗ | bool cSbtn() | |
| 8818 | { | ||
| 8819 | ✗ | return getInput(btnS); | |
| 8820 | } | ||
| 8821 | 208608 | bool cLbtn() | |
| 8822 | { | ||
| 8823 | 208608 | return getInput(btnL); | |
| 8824 | } | ||
| 8825 | 208608 | bool cRbtn() | |
| 8826 | { | ||
| 8827 | 208608 | return getInput(btnR); | |
| 8828 | } | ||
| 8829 | ✗ | bool cPbtn() | |
| 8830 | { | ||
| 8831 | ✗ | return getInput(btnP); | |
| 8832 | } | ||
| 8833 | ✗ | bool cEx1btn() | |
| 8834 | { | ||
| 8835 | ✗ | return getInput(btnEx1); | |
| 8836 | } | ||
| 8837 | ✗ | bool cEx2btn() | |
| 8838 | { | ||
| 8839 | ✗ | return getInput(btnEx2); | |
| 8840 | } | ||
| 8841 | ✗ | bool cEx3btn() | |
| 8842 | { | ||
| 8843 | ✗ | return getInput(btnEx3); | |
| 8844 | } | ||
| 8845 | ✗ | bool cEx4btn() | |
| 8846 | { | ||
| 8847 | ✗ | return getInput(btnEx4); | |
| 8848 | } | ||
| 8849 | ✗ | bool AxisUp() | |
| 8850 | { | ||
| 8851 | ✗ | return getInput(btnAxisUp); | |
| 8852 | } | ||
| 8853 | ✗ | bool AxisDown() | |
| 8854 | { | ||
| 8855 | ✗ | return getInput(btnAxisDown); | |
| 8856 | } | ||
| 8857 | ✗ | bool AxisLeft() | |
| 8858 | { | ||
| 8859 | ✗ | return getInput(btnAxisLeft); | |
| 8860 | } | ||
| 8861 | ✗ | bool AxisRight() | |
| 8862 | { | ||
| 8863 | ✗ | return getInput(btnAxisRight); | |
| 8864 | } | ||
| 8865 | |||
| 8866 | ✗ | bool cMbtn() | |
| 8867 | { | ||
| 8868 | ✗ | return getInput(btnM); | |
| 8869 | } | ||
| 8870 | ✗ | bool cF12() | |
| 8871 | { | ||
| 8872 | ✗ | return getInput(btnF12); | |
| 8873 | } | ||
| 8874 | ✗ | bool cF11() | |
| 8875 | { | ||
| 8876 | ✗ | return getInput(btnF11); | |
| 8877 | } | ||
| 8878 | ✗ | bool cF5() | |
| 8879 | { | ||
| 8880 | ✗ | return getInput(btnF5); | |
| 8881 | } | ||
| 8882 | ✗ | bool cQ() | |
| 8883 | { | ||
| 8884 | ✗ | return getInput(btnQ); | |
| 8885 | } | ||
| 8886 | ✗ | bool cI() | |
| 8887 | { | ||
| 8888 | ✗ | return getInput(btnI); | |
| 8889 | } | ||
| 8890 | |||
| 8891 | 208304 | bool rUp() | |
| 8892 | { | ||
| 8893 | 208304 | return getInput(btnUp, true); | |
| 8894 | } | ||
| 8895 | 208096 | bool rDown() | |
| 8896 | { | ||
| 8897 | 208096 | return getInput(btnDown, true); | |
| 8898 | } | ||
| 8899 | 207900 | bool rLeft() | |
| 8900 | { | ||
| 8901 | 207900 | return getInput(btnLeft, true); | |
| 8902 | } | ||
| 8903 | 207171 | bool rRight() | |
| 8904 | { | ||
| 8905 | 207171 | return getInput(btnRight, true); | |
| 8906 | } | ||
| 8907 | 6570 | bool rAbtn() | |
| 8908 | { | ||
| 8909 | 6570 | return getInput(btnA, true); | |
| 8910 | } | ||
| 8911 | 4619 | bool rBbtn() | |
| 8912 | { | ||
| 8913 | 4619 | return getInput(btnB, true); | |
| 8914 | } | ||
| 8915 | 14378445 | bool rSbtn() | |
| 8916 | { | ||
| 8917 | 14378445 | return getInput(btnS, true); | |
| 8918 | } | ||
| 8919 | 18325316 | bool rMbtn() | |
| 8920 | { | ||
| 8921 | 18325316 | return getInput(btnM, true); | |
| 8922 | } | ||
| 8923 | 185250 | bool rLbtn() | |
| 8924 | { | ||
| 8925 | 185250 | return getInput(btnL, true); | |
| 8926 | } | ||
| 8927 | 185245 | bool rRbtn() | |
| 8928 | { | ||
| 8929 | 185245 | return getInput(btnR, true); | |
| 8930 | } | ||
| 8931 | 14379178 | bool rPbtn() | |
| 8932 | { | ||
| 8933 | 14379178 | return getInput(btnP, true); | |
| 8934 | } | ||
| 8935 | ✗ | bool rEx1btn() | |
| 8936 | { | ||
| 8937 | ✗ | return getInput(btnEx1, true); | |
| 8938 | } | ||
| 8939 | ✗ | bool rEx2btn() | |
| 8940 | { | ||
| 8941 | ✗ | return getInput(btnEx2, true); | |
| 8942 | } | ||
| 8943 | 195896 | bool rEx3btn() | |
| 8944 | { | ||
| 8945 | 195896 | return getInput(btnEx3, true); | |
| 8946 | } | ||
| 8947 | 195896 | bool rEx4btn() | |
| 8948 | { | ||
| 8949 | 195896 | return getInput(btnEx4, true); | |
| 8950 | } | ||
| 8951 | ✗ | bool rAxisUp() | |
| 8952 | { | ||
| 8953 | ✗ | return getInput(btnAxisUp, true); | |
| 8954 | } | ||
| 8955 | ✗ | bool rAxisDown() | |
| 8956 | { | ||
| 8957 | ✗ | return getInput(btnAxisDown, true); | |
| 8958 | } | ||
| 8959 | ✗ | bool rAxisLeft() | |
| 8960 | { | ||
| 8961 | ✗ | return getInput(btnAxisLeft, true); | |
| 8962 | } | ||
| 8963 | ✗ | bool rAxisRight() | |
| 8964 | { | ||
| 8965 | ✗ | return getInput(btnAxisRight, true); | |
| 8966 | } | ||
| 8967 | |||
| 8968 | ✗ | bool rF11() | |
| 8969 | { | ||
| 8970 | ✗ | return getInput(btnF11, true); | |
| 8971 | } | ||
| 8972 | ✗ | bool rQ() | |
| 8973 | { | ||
| 8974 | ✗ | return getInput(btnQ, true); | |
| 8975 | } | ||
| 8976 | ✗ | bool rI() | |
| 8977 | { | ||
| 8978 | ✗ | return getInput(btnI, true); | |
| 8979 | } | ||
| 8980 | |||
| 8981 | 36619327 | bool DrunkUp() | |
| 8982 | { | ||
| 8983 | 36619327 | return getInput(btnUp, false, true); | |
| 8984 | } | ||
| 8985 | 33417586 | bool DrunkDown() | |
| 8986 | { | ||
| 8987 | 33417586 | return getInput(btnDown, false, true); | |
| 8988 | } | ||
| 8989 | 19594911 | bool DrunkLeft() | |
| 8990 | { | ||
| 8991 | 19594911 | return getInput(btnLeft, false, true); | |
| 8992 | } | ||
| 8993 | 16670154 | bool DrunkRight() | |
| 8994 | { | ||
| 8995 | 16670154 | return getInput(btnRight, false, true); | |
| 8996 | } | ||
| 8997 | 15783438 | bool DrunkcAbtn() | |
| 8998 | { | ||
| 8999 | 15783438 | return getInput(btnA, false, true); | |
| 9000 | } | ||
| 9001 | 15223880 | bool DrunkcBbtn() | |
| 9002 | { | ||
| 9003 | 15223880 | return getInput(btnB, false, true); | |
| 9004 | } | ||
| 9005 | 14170386 | bool DrunkcEx1btn() | |
| 9006 | { | ||
| 9007 | 14170386 | return getInput(btnEx1, false, true); | |
| 9008 | } | ||
| 9009 | 14169018 | bool DrunkcEx2btn() | |
| 9010 | { | ||
| 9011 | 14169018 | return getInput(btnEx2, false, true); | |
| 9012 | } | ||
| 9013 | ✗ | bool DrunkcSbtn() | |
| 9014 | { | ||
| 9015 | ✗ | return getInput(btnS, false, true); | |
| 9016 | } | ||
| 9017 | ✗ | bool DrunkcMbtn() | |
| 9018 | { | ||
| 9019 | ✗ | return getInput(btnM, false, true); | |
| 9020 | } | ||
| 9021 | ✗ | bool DrunkcLbtn() | |
| 9022 | { | ||
| 9023 | ✗ | return getInput(btnL, false, true); | |
| 9024 | } | ||
| 9025 | ✗ | bool DrunkcRbtn() | |
| 9026 | { | ||
| 9027 | ✗ | return getInput(btnR, false, true); | |
| 9028 | } | ||
| 9029 | ✗ | bool DrunkcPbtn() | |
| 9030 | { | ||
| 9031 | ✗ | return getInput(btnP, false, true); | |
| 9032 | } | ||
| 9033 | |||
| 9034 | ✗ | bool DrunkrUp() | |
| 9035 | { | ||
| 9036 | ✗ | return getInput(btnUp, true, true); | |
| 9037 | } | ||
| 9038 | ✗ | bool DrunkrDown() | |
| 9039 | { | ||
| 9040 | ✗ | return getInput(btnDown, true, true); | |
| 9041 | } | ||
| 9042 | ✗ | bool DrunkrLeft() | |
| 9043 | { | ||
| 9044 | ✗ | return getInput(btnLeft, true, true); | |
| 9045 | } | ||
| 9046 | ✗ | bool DrunkrRight() | |
| 9047 | { | ||
| 9048 | ✗ | return getInput(btnRight, true, true); | |
| 9049 | } | ||
| 9050 | 11842235 | bool DrunkrAbtn() | |
| 9051 | { | ||
| 9052 | 11842235 | return getInput(btnA, true, true); | |
| 9053 | } | ||
| 9054 | 11870824 | bool DrunkrBbtn() | |
| 9055 | { | ||
| 9056 | 11870824 | return getInput(btnB, true, true); | |
| 9057 | } | ||
| 9058 | 502081 | bool DrunkrEx1btn() | |
| 9059 | { | ||
| 9060 | 502081 | return getInput(btnEx1, true, true); | |
| 9061 | } | ||
| 9062 | 501902 | bool DrunkrEx2btn() | |
| 9063 | { | ||
| 9064 | 501902 | return getInput(btnEx2, true, true); | |
| 9065 | } | ||
| 9066 | ✗ | bool DrunkrEx3btn() | |
| 9067 | { | ||
| 9068 | ✗ | return getInput(btnEx3, true, true); | |
| 9069 | } | ||
| 9070 | ✗ | bool DrunkrEx4btn() | |
| 9071 | { | ||
| 9072 | ✗ | return getInput(btnEx4, true, true); | |
| 9073 | } | ||
| 9074 | ✗ | bool DrunkrSbtn() | |
| 9075 | { | ||
| 9076 | ✗ | return getInput(btnS, true, true); | |
| 9077 | } | ||
| 9078 | ✗ | bool DrunkrMbtn() | |
| 9079 | { | ||
| 9080 | ✗ | return getInput(btnM, true, true); | |
| 9081 | } | ||
| 9082 | 12908088 | bool DrunkrLbtn() | |
| 9083 | { | ||
| 9084 | 12908088 | return getInput(btnL, true, true); | |
| 9085 | } | ||
| 9086 | 12902783 | bool DrunkrRbtn() | |
| 9087 | { | ||
| 9088 | 12902783 | return getInput(btnR, true, true); | |
| 9089 | } | ||
| 9090 | ✗ | bool DrunkrPbtn() | |
| 9091 | { | ||
| 9092 | ✗ | return getInput(btnP, true, true); | |
| 9093 | } | ||
| 9094 | |||
| 9095 | 18809 | void eat_buttons() | |
| 9096 | { | ||
| 9097 | 18809 | getInput(btnA, true, false, true); | |
| 9098 | 18809 | getInput(btnB, true, false, true); | |
| 9099 | 18809 | getInput(btnS, true, false, true); | |
| 9100 | 18809 | getInput(btnM, true, false, true); | |
| 9101 | 18809 | getInput(btnL, true, false, true); | |
| 9102 | 18809 | getInput(btnR, true, false, true); | |
| 9103 | 18809 | getInput(btnP, true, false, true); | |
| 9104 | 18809 | getInput(btnEx1, true, false, true); | |
| 9105 | 18809 | getInput(btnEx2, true, false, true); | |
| 9106 | 18809 | getInput(btnEx3, true, false, true); | |
| 9107 | 18809 | getInput(btnEx4, true, false, true); | |
| 9108 | 18809 | } | |
| 9109 | |||
| 9110 | // Is true for the _first frame_ of a key press. | ||
| 9111 | // But! it is possible that a script manually sets the value of KeyPress, | ||
| 9112 | // in which case it will be restored to the "true" value based on `key_current_frame` | ||
| 9113 | // and `key_previous_frame` on the next frame. | ||
| 9114 | 61 | bool zc_readkey(int32_t k, bool ignoreDisable) | |
| 9115 | { | ||
| 9116 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 61 times.
|
61 | if(ignoreDisable) return KeyPress[k]; |
| 9117 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 61 times.
|
61 | switch(k) |
| 9118 | { | ||
| 9119 | case KEY_F7: | ||
| 9120 | case KEY_F8: | ||
| 9121 | case KEY_F9: | ||
| 9122 | ✗ | return KeyPress[k]; | |
| 9123 | |||
| 9124 | default: | ||
| 9125 |
2/2✓ Branch 0 taken 46 times.
✓ Branch 1 taken 15 times.
|
61 | return KeyPress[k] && !disabledKeys[k]; |
| 9126 | } | ||
| 9127 | 61 | } | |
| 9128 | |||
| 9129 | // Is true for _every frame_ a key is held down. | ||
| 9130 | // But! it is possible that a script manually sets the value of KeyInput, | ||
| 9131 | // in which case it will be restored to the "true" value based on `key_current_frame` | ||
| 9132 | // on the next frame. | ||
| 9133 | ✗ | bool zc_getkey(int32_t k, bool ignoreDisable) | |
| 9134 | { | ||
| 9135 | ✗ | if(ignoreDisable) return KeyInput[k]; | |
| 9136 | ✗ | switch(k) | |
| 9137 | { | ||
| 9138 | case KEY_F7: | ||
| 9139 | case KEY_F8: | ||
| 9140 | case KEY_F9: | ||
| 9141 | ✗ | return KeyInput[k]; | |
| 9142 | |||
| 9143 | default: | ||
| 9144 | ✗ | return KeyInput[k] && !disabledKeys[k]; | |
| 9145 | } | ||
| 9146 | ✗ | } | |
| 9147 | |||
| 9148 | // Reads (and then clears) the current frame key state directly. | ||
| 9149 | // Scripts can also modify `key_current_frame`. | ||
| 9150 | 933 | bool zc_readrawkey(int32_t k, bool ignoreDisable) | |
| 9151 | { | ||
| 9152 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 931 times.
|
933 | if(zc_getrawkey(k, ignoreDisable)) |
| 9153 | { | ||
| 9154 | 2 | _key[k]=key[k]=key_current_frame[k]=0; | |
| 9155 | 2 | return true; | |
| 9156 | } | ||
| 9157 | 931 | _key[k]=key[k]=key_current_frame[k]=0; | |
| 9158 | 931 | return false; | |
| 9159 | 933 | } | |
| 9160 | |||
| 9161 | // Reads the current frame key state directly. | ||
| 9162 | // Scripts can also modify `key_current_frame`. | ||
| 9163 | 124411475 | bool zc_getrawkey(int32_t k, bool ignoreDisable) | |
| 9164 | { | ||
| 9165 |
2/2✓ Branch 0 taken 106086037 times.
✓ Branch 1 taken 18325438 times.
|
124411475 | if(ignoreDisable) return key_current_frame[k]; |
| 9166 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18325438 times.
|
18325438 | switch(k) |
| 9167 | { | ||
| 9168 | case KEY_F7: | ||
| 9169 | case KEY_F8: | ||
| 9170 | case KEY_F9: | ||
| 9171 | ✗ | return key_current_frame[k]; | |
| 9172 | |||
| 9173 | default: | ||
| 9174 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18325438 times.
|
18325438 | return key_current_frame[k] && !disabledKeys[k]; |
| 9175 | } | ||
| 9176 | 124411475 | } | |
| 9177 | |||
| 9178 | // Only used for a handful of keys, like tilde and Function keys. | ||
| 9179 | // This state is never read within the game. | ||
| 9180 | // It exists so that all keyboard input still functions during replay, | ||
| 9181 | // without inadvertently doing things like toggling throttling if the player | ||
| 9182 | // presses ~ | ||
| 9183 | 21713 | bool zc_get_system_key(int32_t k) | |
| 9184 | { | ||
| 9185 | 21713 | return key_system[k]; | |
| 9186 | } | ||
| 9187 | |||
| 9188 | // True for the _first_ frame of a key press. | ||
| 9189 | 164927844 | bool zc_read_system_key(int32_t k) | |
| 9190 | { | ||
| 9191 | 164927844 | return key_system_press[k]; | |
| 9192 | } | ||
| 9193 | |||
| 9194 | 2327315132 | bool is_system_key(int32_t k) | |
| 9195 | { | ||
| 9196 |
2/2✓ Branch 0 taken 2162387288 times.
✓ Branch 1 taken 164927844 times.
|
2327315132 | switch (k) |
| 9197 | { | ||
| 9198 | case KEY_BACKQUOTE: | ||
| 9199 | case KEY_CLOSEBRACE: | ||
| 9200 | case KEY_END: | ||
| 9201 | case KEY_HOME: | ||
| 9202 | case KEY_OPENBRACE: | ||
| 9203 | case KEY_PGDN: | ||
| 9204 | case KEY_PGUP: | ||
| 9205 | case KEY_TAB: | ||
| 9206 | case KEY_TILDE: | ||
| 9207 | 164927844 | return true; | |
| 9208 | } | ||
| 9209 | 2162387288 | return is_Fkey(k); | |
| 9210 | 2327315132 | } | |
| 9211 | |||
| 9212 | 18325316 | void update_system_keys() | |
| 9213 | { | ||
| 9214 |
2/2✓ Branch 0 taken 2327315132 times.
✓ Branch 1 taken 18325316 times.
|
2345640448 | for (int32_t q = 0; q < 127; ++q) |
| 9215 | { | ||
| 9216 |
2/2✓ Branch 0 taken 384831636 times.
✓ Branch 1 taken 1942483496 times.
|
2327315132 | if (!is_system_key(q)) |
| 9217 | 1942483496 | continue; | |
| 9218 | |||
| 9219 | 384831636 | key_system[q] = key[q]; | |
| 9220 |
1/2✓ Branch 0 taken 384831636 times.
✗ Branch 1 not taken.
|
384831636 | key_system_press[q] = key_system[q] && !key_system_previous[q]; |
| 9221 | 384831636 | key_system_previous[q] = key_system[q]; | |
| 9222 | 384831636 | } | |
| 9223 | 18325316 | } | |
| 9224 | |||
| 9225 | 19591828 | void update_keys() | |
| 9226 | { | ||
| 9227 |
2/2✓ Branch 0 taken 2488162156 times.
✓ Branch 1 taken 19591828 times.
|
2507753984 | for (int32_t q = 0; q < 127; ++q) |
| 9228 | { | ||
| 9229 | // When replaying, replay.cpp takes care of updating `key_current_frame`. | ||
| 9230 |
2/2✓ Branch 0 taken 2488149456 times.
✓ Branch 1 taken 12700 times.
|
2488162156 | if (!replay_is_replaying()) |
| 9231 | 12700 | key_current_frame[q] = key[q]; | |
| 9232 | |||
| 9233 |
2/2✓ Branch 0 taken 2469057285 times.
✓ Branch 1 taken 19104871 times.
|
2488162156 | KeyPress[q] = key_current_frame[q] && !key_previous_frame[q]; |
| 9234 | 2488162156 | KeyInput[q] = key_current_frame[q]; | |
| 9235 | 2488162156 | key_previous_frame[q] = key_current_frame[q]; | |
| 9236 | 2488162156 | } | |
| 9237 | 19591828 | } | |
| 9238 | |||
| 9239 | ✗ | bool zc_disablekey(int32_t k, bool val) | |
| 9240 | { | ||
| 9241 | ✗ | switch(k) | |
| 9242 | { | ||
| 9243 | case KEY_F7: | ||
| 9244 | case KEY_F8: | ||
| 9245 | case KEY_F9: | ||
| 9246 | ✗ | return false; | |
| 9247 | |||
| 9248 | default: | ||
| 9249 | ✗ | disabledKeys[k] = val; | |
| 9250 | ✗ | return true; | |
| 9251 | } | ||
| 9252 | ✗ | } | |
| 9253 | |||
| 9254 | ✗ | void zc_putpixel(int32_t layer, int32_t x, int32_t y, int32_t cset, int32_t color, int32_t timer) | |
| 9255 | { | ||
| 9256 | ✗ | timer=timer; | |
| 9257 | ✗ | particles.add(new particle(zfix(x), zfix(y), layer, cset, color)); | |
| 9258 | ✗ | } | |
| 9259 |